Installs loaders that are already installed in sub-module
jameswomack opened this issue ยท 4 comments
Thank you for producing this awesome module! ๐ ๐ธ
I use a wrapper around Webpack rather than Webpack directly. That wrapper contains css-loader, style-loader, babel-loader etc. I've also added npm-install-webpack-plugin to it. When I build an app with this setup, it installs each of the loaders it comes across even though they're already available in the wrapper. This results in superfluous loaders in my app that are already taken care of by the wrapper.
I imagine that this can be taken care of by adding locations npm-install-webpack-plugin can resolve relative to. If it resolved in the location it was installed (or allowed me to blacklist certain modules or allowed me to skip loaders) it would solve this issue.
Any thoughts?
First, what wrapper are you using?
Second, in you project, what happens when you run:
$ node
> require("css-loader")
@ericlemmons The wrapper is called Abacus, it's a tool at Netflix that's not been open-sourced yet. I'm away from my computer, I'll check back in when I run the command as asked.
@jameswomack From the way you make it sound, css-loader
is managed by Abacus (meaning your configs never have to worry about setting it as a loader), but this project sees a request for css-loader
and installs it, as it's unable to find it.
What my worry is is that the dependency is at ./node_modules/@netflix/abacus/node_modules/css-loader
or similar, in which case a root-level require("css-loader")
will fail because it's not in the root. (This would only be a problem on npm@v2
!)
So, in addition to trying require("css-loader")
locally, I'd need to know your npm
& node
version just to be sure.
Thanks!
Hi! Me and @pirelenito are trying to add this to Sagui - you can see it in PR 247 - and we are having the same issue (for every webpack loader). In our case, I can verify that css-loader
et al are installed flat in node_modules
, yet they are not being picked up.
Doing import 'css-loader'
results in this error, which is what I would expect:
ERROR in ./~/postcss/lib/previous-map.js
Module not found: Error: Cannot resolve module 'fs' in /Users/fernando/test-sagui-auto-install/node_modules/postcss/lib
@ ./~/postcss/lib/previous-map.js 17:10-23
ERROR in ./~/svgo/lib/svgo/config.js
Module not found: Error: Cannot resolve module 'fs' in /Users/fernando/test-sagui-auto-install/node_modules/svgo/lib/svgo
@ ./~/svgo/lib/svgo/config.js 3:9-22
ERROR in ./~/browserslist/index.js
Module not found: Error: Cannot resolve module 'fs' in /Users/fernando/test-sagui-auto-install/node_modules/browserslist
@ ./~/browserslist/index.js 3:14-27