webpack-node-externals icon indicating copy to clipboard operation
webpack-node-externals copied to clipboard

Support for Yarn 2 PnP

Open jakubzitny opened this issue 3 years ago • 1 comments

In Yarn 2 PnP mode, there is no node_modules folder. Everything is in .yarn cache and kept loaded in memory. Would it be possible to add support for this in webpack-node-externals or have you already thought about it?

jakubzitny avatar May 20 '21 18:05 jakubzitny

Bumping this up. I expected webpack-node-externals to just work with PnP and it took me a while to find that this was my issue.

I found two packages that implement this:

  • https://github.com/jonhartnett/webpack-pnp-externals (looks more complete/correct)
  • https://github.com/tonyfromundefined/pnp-node-externals

At first glance it seems that this could be handled by another package than webpack-node-externals, but ideally webpack-node-externals, or a higher-level package should handle package manager context automatically, the rationales are:

  • this package is called webpack-node-externals, not webpack-npm-externals
  • standardized options
  • most importantly: to avoid having the package manager setup leak into webpack configs

tarikjn avatar Sep 25 '21 20:09 tarikjn