Yarn recently unveiled exciting work on an alternative installation strategy, Plug'n'Play. By using it, one can avoid entirely the node_modules hell. Let's discuss why we would do that, and how.
for a typical project • Impractical for the HTTP use case • Has a runtime impact as well The ugly sides of a system used by the planet node_modules flaws
the resolution foo/file.js Package manager (yarn install) Node Resolver (node_modules) What is the closest node_modules? Which file asks for foo/file.js? Does it contain foo/file.js? require(“foo/file.js”) /n_m/bar/n_m/foo/file.js
the resolution foo/file.js Package manager (yarn install) Node Resolver (node_modules) What is the closest node_modules? Which file asks for foo/file.js? Does it contain foo/file.js? require(“foo/file.js”) /n_m/bar/n_m/foo/file.js
Package manager (yarn install) Node Resolver (.pnp.js) What version of foo does bar depends on? Which package asks for foo? Where is located this version of foo? require(“foo/file.js”) /cache/foo-1.0/file.js
across multiple projects • Strict safety mechanisms for ensure consistency • Enable tight integrations with the dependency tree • … node_modules? no_modules !