I do want to give a shout-out to the Yarn maintainers, though. I got stuck trying to figure out how to get those aliases configured with Yarn instead, and gave up on PnP at that point. That wouldn't work as-is, because again Yarn has to have full control over all package file access, and so it needs to understand what those aliases are. We had a few aliases set up using, so that we could use the same aliases with Node, Jest, and Webpack. Where I personally gave up on trying to use Yarn + PnP for my team's project was folder aliases. This does work, but I've seen some folks complain about it conceptually. The compat hack they've implemented is keeping that PR up to date against each version of TS, generating patches, and silently patching whatever version of TypeScript you've installed. The Yarn maintainers put up a PR to modify the TypeScript core tooling to understand PnP behavior, but that was never merged. some-script.js or something along those lines. some-script.js any more - it has to be something like yarn node. This means using Yarn as the bootstrap tool for all JS script operations, so that it can override Node's require behavior before any other packages are loaded. In general, Yarn now needs to own all access to all package files on disk. One weakness is that you can't just right-click and "Go to Definition" for something that's defined in a library any more, but there's a VS Code plugin that teaches VSC how to look inside the zipped packages to let that work again. Yarn has the ability to generate "SDK" compat configs for typical tools like VS Code and WebStorm. That's no longer true with PnP, so all those tools break out of the box.įrom what I saw, the ecosystem compat story is certainly improved from when Yarn 2 first came out. The issue is with the rest of the ecosystem, where all tools have been written expecting to find package files extracted onto disk in node_modules. It's not like the core concept is broken. PnP does work overall as far as Yarn itself is concerned. I was trying this out in late 2020, so it's been long enough I don't remember the exact details, but let me start writing and see what comes to mind.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |