3 ms·
Yarn provides a "Plug'n'Play" mode implementing exactly this behavior. Dependencies are kept as compressed archives and a loader file is generated so Node can
by demurgos 4y ago
Yarn provides a "Plug'n'Play" mode implementing exactly this behavior.
Dependencies are kept as compressed archives and a loader file is generated so Node can read them directly. If you start Node through Yarn (`yarn node main.js`), it automatically passes the correct flags, but you can also do it manually (something like `node -r .pnp.cjs --experimental-loader .pnp.loader.mjs main.js`).
Overall I found this mode to work pretty good. I'm using it for a medium-sized Angular (+ TypeScript) project. It also noticeably improves install times. The PnP mode is stricter about dependencies and expects dependencies to be readonly. A couple dependencies may need to be marked as "unplugged" (installed a regular decompressed dependencies) as a workaround.
I'd recommend using this mode if you can.