News for hackers. Stuff that matters.
Re:Yarn 4.0 by Timon3 on Monday October 23, 2023 @12:48PM (#37988234)
While I personally enjoy Yarn 2+ a lot and prefer it for private projects (I'll explain a bit about my setup at the end), for a long time both the docs and the implementation pretty much guaranteed that it would fail:

- many basic things were missing from the docs for a long time, or at least were easier to find in Github issues (e.g. "what should I gitignore")

- defaulting to PnP meant that, without configuration, things wouldn't properly work on many projects based on frameworks/toolkits/editors

- opinionated defaults made things harder than necessary (e.g. why does `yarn init` create a Git repository?)

You either had to accept/work around these issues, or configure everything to work as e.g. npm or yarn 1 did. I did the latter, and am still happy that I bought in - but I can very much understand anyone who didn't.

My preferred setup with Yarn 2+ projects is:

- use the node-modules linker (I tried pnp every couple of months and always ran into some issue, which I sometimes sent PRs for, but there was always something not working)

- gitignore as described for zero-installs[0] (even though I don't use pnp; this has the advantage that you'll have a ZIP copy of every module cached, leading to very fast local/CI installs and resistance against registry issues)

- create .gitattributes file as described at the end of [0] to hide the binary files from diffs

- add the base SDK[1] for WebStorm support (this rarely worked well)

- add the TypeScript plugin

[0]: https://yarnpkg.com/getting-started/qa#which-files-should-be... [1]: https://yarnpkg.com/getting-started/editor-sdks

There are no comments on this comment yet.