Add support for Yarn PnP - #49
Conversation
|
Chatted with @Turbo87 in DM, I think we should move to inheriting This change would essentially be following the same move in Yarn itself (away from using |
|
Ah, apparently See here for the two implementations (on Node 10):
So the question here is, should we inherit all of |
|
@rwjblue unfortunately, it's not quite as easy. |
|
we will most likely resolve this another way (adjusting |
|
👍 thanks anyway Tobias for taking the time to put together a PR :) |
Yarn Plug'n'Play is using a custom resolver to lookup dependencies from a machine-wide global location, instead of keeping
node_modulesduplicated in every project.When
yarn runis used and it detects that it is running in PnP mode it will call the child process using--require .pnp.js, with.pnp.jsbeing a file generated per-project by Yarn. This will enable PnP mode for the child process and make the PnP API available viarequire('pnpapi').Since
workerpoolis also forking off child processes it would need a similar mechanism to ensure that those child processes are able to resolve their dependencies correctly. This PR adds the necessary--requireargument to the fork option if PnP mode is detected by checkingprocess.versions.pnp.In case you're wondering: we're working on making
ember-clicompatible with Yarn PnP and that is usingbroccoli-babel-transpiler, which is usingworkerpoolunder the hood./cc @arcanis @rwjblue