Live data from Hacker News

Hello Yarn 2, Goodbye node_modules

freddixx.medium.com

21–30 of 160 posts

Re: Hello Yarn 2, Goodbye node_modules

#23

So the cost is you add another tool (yarn) to your toolchain and this is better than NPM because your deps are all in one folder and just mapped through a header file instead of being duplicated for every project, am I understanding that right?

For what it is worth, npm v7 added "workspaces" ("monorepo") support (similar to yarn's) where all the node_modules are hosted a level higher in the folder tree and shared.

https://docs.npmjs.com/cli/v7/using-npm/workspaces/

Re: Hello Yarn 2, Goodbye node_modules

#24
post #2

Kind of frustrating that this article doesn’t really describe in a nutshell how they do it, despite it being the title. It kind of assumes you already read about dropping node_modules.

For anyone curious, that’s mainly described in the linked article here: https://yarnpkg.com/features/pnp

It's interesting that node.js packaging has improved by borrowing an idea from the PHP world.

Re: Hello Yarn 2, Goodbye node_modules

#25
post #12

Yarn 3.0 was released in July 2021 ( https://dev.to/arcanis/yarn-3-0-performances-esbuild-better-... ) Meanwhile, as much as I respect the work of Mael (yarn maintainer) I’ve switched back to npm. Mostly because: - isaacs (original creator of npm) did some commits lately - now backed by GitHub - they introduced workspaces (monorepo support) in npm 7 - it’s still easier to use the standard tooling in dev/ci/prod - lik…

Can you fix transitive dependencies in npm natively yet? That's why I switched to yarn.

Re: Hello Yarn 2, Goodbye node_modules

#26
I see absolutely no reason to upgrade. I don't have any problems with npm7 right now and I fail to see why I'd need to change all these things and learn a new tool. Maybe the patch thing.

But to say that you eliminated node_modules and then introduce a new folder which will have the same files inside it... sounds like madness to me.

No thanks.

Re: Hello Yarn 2, Goodbye node_modules

#27
post #17

Last time I tried, yarn 2 was totally unusable. Apparently, it would work in a future world where all packages in the registry were perfect. Has that future arrived?

My experience is that Yarn v2 works great as long as you stick with the `node_modules` linker. It's the "Plug 'n Play" functionality that is great in theory but still rough in practice.

I've been using Yarn v2 on a decent-sized mixed-codebase JS app since the fall, and we just switched over to using it for both of the Redux Toolkit and React-Redux repos.

Re: Hello Yarn 2, Goodbye node_modules

#29

It’s insane that only now we have bundler

If that. Yarn 2 still has a bunch of issues, and they've already released Yarn 3. So now we have this fragmented scenario where tons of people are still on Yarn 1 because of compatibility issues, Yarn 2 can still be a pain to work with, and now there's a Yarn 3...

Whereas Bundler just works (generally speaking).

Re: Hello Yarn 2, Goodbye node_modules

#30
post #12

Yarn 3.0 was released in July 2021 ( https://dev.to/arcanis/yarn-3-0-performances-esbuild-better-... ) Meanwhile, as much as I respect the work of Mael (yarn maintainer) I’ve switched back to npm. Mostly because: - isaacs (original creator of npm) did some commits lately - now backed by GitHub - they introduced workspaces (monorepo support) in npm 7 - it’s still easier to use the standard tooling in dev/ci/prod - lik…

What kind of issues did you encounter converting to yarn 2/3?
Post reply on HN