DEV Community

Cover image for Yarn 3.0 🚀🤖 Performances, ESBuild, Better Patches, ...

Yarn 3.0 🚀🤖 Performances, ESBuild, Better Patches, ...

Maël Nison on July 26, 2021

Hello! Long time no see! Back in December, we decided to start working on our next major release, the 3.0. It took a bit of time to do everything w...
Collapse
 
iskin profile image
Andrey Sitnik

yarn up -R! It was my last blocker from migration from Yarn 1.

Collapse
 
blikblum profile image
Luiz Américo

Thanks for the update. The new shell concurrent feature saved my day.

How do i upgrade from berry v2 to berry v3.

I used yarn set version latest but it used the development branch something i don t want

Collapse
 
hydrosquall profile image
Cameron Yick

I just tested this out upgrading from v2, dev.to/hydrosquall/comment/1gop5, hope this helps!

Collapse
 
liuliangsir profile image
流浪大法师

how to upgrade global yarn from berry v2 to berry v3 when using npm

Collapse
 
corysimmons profile image
Cory Simmons

Been using Yarn 2 for several months now. PnP is fine except when 3rd party projects have stuff like references to node_modules hard-coded in their distributable. I don't see a workaround to this, and a HUGE chunk of 3rd party libraries do this. I'm going back to Yarn 1 or even NPM (if work on Yarn 1 halts).

Yarn 1 was cool, and moved NPM to get their act together a bit, but I hate when maintainers just assume the rest of the ecosystem will migrate with them. This is why Python 3 took a decade to be adopted, and that adoption only happened because people were absolutely forced to use Python whereas switching back to NPM is a breeze.

Almost every single day, for months, I've ran into problems with PnP...

Collapse
 
arcanis profile image
Maël Nison

You can enable the node_modules just fine if that's what you prefer.

From my experience, very few 3rd-party libraries actually hardcode the n_m folder anymore, and I found them relatively easy to ignore (RN being the main contender). If large projects like Next or Gatsby manage to make things work without trouble, there's really no reason in 2021 for projects to still misslist their dependencies.

Collapse
 
corysimmons profile image
Cory Simmons • Edited

You can enable the node_modules just fine if that's what you prefer.

You're referring to nodeLinker? Doesn't that just disable PnP project-wide? In which case, why use Yarn 2+ at all?

I agree it'd be nice if every maintainer fixed their projects to not reference n_m, but that's just not the reality of the Node ecosystem... github.com/search?q=%22node_module...

Yesterday my use case was trying to use Playwright (30k Stars, hundreds of thousands of downloads every week) with Yarn PnP. Nope.

The maintainer literally said "Wait what version of Yarn?" I said "2.4.2", he said "Ah yarn 2 my old enemy" github.com/microsoft/playwright/se...

I dunno man. I don't want to dog the project and I really appreciated what Yarn 1 did, and the goals of Yarn 2, but someone needs to say "Look, I've used this thing for several months on a decent sized project and it's painful. Every few days I run into something. I wish I would've just used Yarn 1" so others know what they're getting themselves into.

I'm not the only one with this opinion news.ycombinator.com/item?id=28122318

Until there is a really straightforward dev-friendly way to say "Okay, this package is fine if it's a zip and this package is probably never going to work with Yarn 2 and would just be easier to plop into node_modules" people are just going to keep jumping ship back to npm.

What dev wants to have to study a ton of docs and do a bunch of workarounds to be able to use a package manager that used to be as simple as yarn add foo?

It's just hard, whereas Yarn 1 wasn't, and npm isn't, and npm has workspaces now. 🤷‍♂️

Thread Thread
 
latobibor profile image
András Tóth

I encountered this opinion today as I was wondering if we should move away from yarn 1 finally. Either to a now magically working yarn 2+ or just back to npm which never stopped working.

Collapse
 
malloc007 profile image
Ryota Murakami

I know ESM as well, but what does it mean ESM support as a package manager?

Collapse
 
borekb profile image
Borek Bernard

Congrats, the release sounds really awesome! ❤️

Collapse
 
maracujajuice profile image
Maurice

Uhm, probably a dumb question but how do we update to yarn 3?

Collapse
 
hydrosquall profile image
Cameron Yick

I used these two commands in sequence:

# Now upgrades you to version 3.0.0
yarn set version berry
# Upgrades to latest version of 3
yarn set version 3.x
Enter fullscreen mode Exit fullscreen mode
Collapse
 
boscheliblack profile image
Bosch-Eli-Black

Thanks! 🙂 For me, just running yarn set version berry was good enough.

If I also ran yarn set version 3.x, it upgraded me to a release candidate version.

Collapse
 
uptonking profile image
uptonking

yarn is good.
BUT I prefer npm 7 workspaces.
Upgrading yarn is a burden now.
npm is bundled with node, so easy.

Collapse
 
milo123459 profile image
Milo

Not sure what's a burdern about yarn up -R but I respect your opinion :)

Collapse
 
xenoterracide profile image
Caleb Cushing

can you still use && or is there a new yarn scripts block? just wondering given the prolifity of && and I guess ||. not expecting full shell eval ;)

Collapse
 
dmail profile image
Damien Maillard

The day yarn support ESM I'll do the switch! I hope it will happen soon 🤞

Collapse
 
larixer profile image
Victor Vlasenko

Yarn supports ESM with node_modules install scheme. The PnP install scheme will support ESM when Node API let this happen

Collapse
 
boscheliblack profile image
Bosch-Eli-Black

Yay! Happy to hear that there are fewer breaking changes this time around, and nice work! 🙂