yarnpkg/yarn

workspaces request: option to symlink all packages into local node_modules

Open

#4219 aperta il 21 ago 2017

Vedi su GitHub
 (8 commenti) (39 reazioni) (0 assegnatari)JavaScript (2731 fork)batch import
cat-featurehelp wantedneeds-discussiontriaged

Metriche repository

Star
 (41.514 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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.

Guida contributor