Search code examples
node.jsnpmyarnpkgyarn-v2

How does node work with Yarn Plug-n-Play?


Yarn 2.0 is bringing PnP to the table, but I don't really understand how I can run javascript with the simple node command anymore if the file has dependencies in the npm registry. node looks for node_modules folders to find dependencies, but since PnP removes the node_modules folder entirely, do I need to use a command other than node now? Or will node introduce some new flag to read the .pnp.js file instad of recursively looking upwards for the nearest node_modules?


Solution

  • yarn node index.js. See the yarn 2 (berry) docs. https://yarnpkg.com/cli/node