This repository was archived by the owner on Feb 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 212
This repository was archived by the owner on Feb 18, 2024. It is now read-only.
Add support for Yarn's Plug n Play mode #1277
Copy link
Copy link
Closed
Labels
Description
Yarn has a new experimental and opt-in mode called "Plug n Play" that means packages are no longer installed into node_modules
and are instead mapped to their cache location at runtime via a custom resolver. See:
yarnpkg/rfcs#101
https://github.com/yarnpkg/rfcs/blob/master/accepted/0000-plug-an-play.md
Whilst this new mode mostly "just works", it requires custom configuration when using certain packages such as webpack or jest. Therefore we should either add native support to Neutrino for these changes (like CRA has) or else document them.
If we were to add native support to Neutrino, we would need to:
- add/configure the various resolver plugins:
- ensure that all of our dependencies/peer dependencies are correctly defined (Yarn will provide error messages about these, so it's just a case of trying and seeing if it works)
- ensure that we're using
require.resolve()
in all the places we should (which I believe we are, though again yarn will helpfully error if not) - (optionally) add support for a
--pnp
option to create-project so projects can be created using PnP out of the box (rather than them needing to be converted over after by runningyarn --pnp
by hand) - document the experimental support for PnP, including any limitations (eg the ESLint issue and whether any of the other test runners/... don't work)
- ask that Yarn hardcode Neutrino's ESLint related package names to work around Declaring shareable configs and plugins in package.json is unreliable eslint/eslint#10125 (comment), similar to what they do for CRA (PnP ESLint compatibility yarnpkg/yarn#6449)
See also:
https://github.com/yarnpkg/pnp-sample-app#plugins
facebook/create-react-app#5136
gordlea, timkelty and elpddev