yarnpkg/yarn

workspaces request: option to symlink all packages into local node_modules

Open

#4.219 geöffnet am 21. Aug. 2017

Auf GitHub ansehen
 (8 Kommentare) (39 Reaktionen) (0 zugewiesene Personen)JavaScript (2.731 Forks)batch import
cat-featurehelp wantedneeds-discussiontriaged

Repository-Metriken

Stars
 (41.514 Stars)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

Feature request: option to symlink modules in node_modules that would normally resolve to their workspace parent directory.

Yarn workspaces works because of the node.js behaviour of looking in parent directories' node_modules when resolving modules.

Webpack doesn't do this by default, to get this behaviour you need to add to the resolve.modules config. Not difficult, but it may trip people up.

But this is harder to work around when you're using something with an automatic webpack config, like create-react-app. To customize webpack in create-react-app, you need to "eject", which causes you to lose a bunch of the advantages of c-r-a.

So thus my feature request: an option that uses symlinks to fully populate node_modules.

Example.

child's package.json has a dependency on foo. All modules in the workspace that depend on foo use the same version, so yarn w/workspaces installs foo into parent/node_modules/foo. My request would be an option that would symlink parent/child/node_modules/foo to parent/node_modules/foo.

Contributor Guide