-
Notifications
You must be signed in to change notification settings - Fork 12k
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
fix(#1875): Support npm linked libraries #2291
fix(#1875): Support npm linked libraries #2291
Conversation
@TheLarkInn can you review? |
The new equivalent of
|
@filipesilva, this PR replaces the module resolution whereas the webpack recommended config adds a fallback. |
@clydin, good eye, thanks for the heads-up! |
@@ -33,7 +33,8 @@ export function getWebpackCommonConfig( | |||
return { | |||
devtool: 'source-map', | |||
resolve: { | |||
extensions: ['.ts', '.js'] | |||
extensions: ['.ts', '.js'], | |||
modules: [ path.join(projectRoot, 'node_modules') ] |
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.
Could you use modules: ['node_modules', path.resolve(projectRoot, 'node_modules')]
instead to have a fallback?
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.
See #2291 (comment) for details.
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.
@filipesilva, @serhiisol: FYI: when I use
modules: ['node_modules', path.resolve(projectRoot, 'node_modules')]
it does not work, while when I use
modules: [ path.join(projectRoot, 'node_modules') ]
it does :)
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.
@mmolhoek, do you have an example?
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.
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.
@clydin, not needed, @serhiisol gave the right modification
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.
@TheLarkInn can you weigh as a webpack core member?
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.
modules: [ path.join(projectRoot, 'node_modules') ]
is correct. Requires absolute path to module directory as described.
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.
Sync branch with master and LGTM pending CI.
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.
Done
Waiting for CI but added approval. |
This patch fixes support for npm linked libraries. More information can be found at angular/angular-cli#2291
This patch fixes support for npm linked libraries. More information can be found at angular/angular-cli#2291
Hi all, I'm also having this error but I don't use webpack, instead I use SystemJS and Vagrant. Do you know how I could emulate the fix you mentioned for these instead? Basically doing this:
But for people not using Webpack. Thank you for your help! |
It seems we also need this fix in webpack-build-test file. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
This PR fixes the problem with linked packages (#1875).
Originally I've used http://webpack.github.io/docs/troubleshooting.html#npm-linked-modules-doesn-t-find-their-dependencies official documentation. But for webpack2 the team has changed also configuration object, which doesn't work like described in the article.
So I've found another release note related to configuration object - https://gist.github.com/sokra/27b24881210b56bbaff7#resolving-options
The most important is
Resolving options
section.So we have to change our configuration object from:
to:
Closes #1875