tl;dr
Webpack should produce the same build whether a module is linked or not.
In depth
Considering the following dependency trees:
project@1.0.0
├── babel-runtime@5.1.9
└── sub-project@1.0.0
sub-project@1.0.0
└── babel-runtime@5.1.9
Notice: NPM does not include babel-runtime under sub-project when npm list is called from project.
Webpack builds something link:
[0] multi main 52 bytes {0} [built]
[1] ./index.js 2.08 kB {0} [built]
[2] ./~/babel-runtime/helpers/interop-require-wildcard.js 148 bytes {0} [built]
[3] ./~/sub-project/index.js 2.46 kB {0} [built]
If we run npm link sub-project we obtain the following tree:
project@1.0.0
├── babel-runtime@5.1.9
└── sub-project@1.0.0 -> /Users/fc/Development/sub-project
Notice: babel-runtime still doesn't appear under sub-project.
But building the project again will duplicate its dependencies:
[0] multi main 52 bytes {0} [built]
[1] ./index.js 2.08 kB {0} [built]
[2] ./~/babel-runtime/helpers/interop-require-wildcard.js 148 bytes {0} [built]
[3] /Users/fc/Development/sub-project/index.js 2.46 kB {0} [built]
[4] /Users/fc/Development/sub-project/~/babel-runtime/helpers/interop-require-wildcard.js 148 bytes {0} [built]
Using resolve.root or changing the resolve scope of loaders do not change anything.
Expectations
It would link to be able the link my in-development modules into my project using npm link without having to tweak the webpack config.
The real problem isn't the build size but the unexpected behaviors raised but duplicated dependencies.
tl;dr
Webpack should produce the same build whether a module is linked or not.
In depth
Considering the following dependency trees:
Notice: NPM does not include
babel-runtimeundersub-projectwhennpm listis called fromproject.Webpack builds something link:
If we run
npm link sub-projectwe obtain the following tree:Notice:
babel-runtimestill doesn't appear undersub-project.But building the project again will duplicate its dependencies:
Using
resolve.rootor changing the resolve scope of loaders do not change anything.Expectations
It would link to be able the link my in-development modules into my project using
npm linkwithout having to tweak the webpack config.The real problem isn't the build size but the unexpected behaviors raised but duplicated dependencies.