Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC: Add npm workspaces #103
RFC: Add npm workspaces #103
Changes from all commits
fe71372
e8221f4
a350c72
2596463
c279a49
de8d71c
25b1683
102660c
3335cf7
8a5080c
26e8ac6
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIUC, this is proposing to link all sub-packages to root-level
node_modules
folder. I find such arrangement as rather problematic, because it allows sub-packages to require other sub-packages that are not listed in the dependencies. Such code will work at runtime when executed inside the monorepo (e.g. when running tests of the package), but will fail once the problematic package is installed from the registry (i.e. when consuming the package in 3rd-party projects).As an example, consider the example presented in the RFC document, with an additional
dep-c
package with no dependencies and a filedep-c/index.js
that's callingrequire('dep-a')
.Now when you run
node -e "require('dep-c')"
from monorepo root, all is good. When you run the same command from a project depending ondep-c
, it will fail withError: Cannot find module 'dep-a'
.In
lerna
, workspace sub-packages are never linked to root-levelnode_modules
, the symlinks are always created between the packages only.As a result,
node -e "require('dep-c')"
executed from monorepo root fails.I understand that hoisting all sub-packages in a shared top-level directory may have benefits. In that case I am proposing to use a different directory name than
node_modules
, e.g..workspace_modules
.