yarnpkg/yarn

workspaces request: option to symlink all packages into local node_modules

Open

#4,219 opened on Aug 21, 2017

View on GitHub
 (8 comments) (39 reactions) (0 assignees)JavaScript (41,514 stars) (2,731 forks)batch import
cat-featurehelp wantedneeds-discussiontriaged

Description

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