Do you want to request a feature or report a bug?
Request a feature.
What is the current behavior?
If the current behavior is a bug, please provide the steps to reproduce.
Paths defined in the
NODE_PATH environment variable are ignored unless manually added in the webpack config under
npm run compile:browserify:
npm run compile:webpack:
What is the expected behavior?
By default, webpack should resolve
node_modules as well as directories in
If this is a feature request, what is motivation or use case for changing the behavior?
- Node supports this (1, 2)
- Other major libraries like browserify and mocha resolve NODE_PATH by default (see demo repo)
This feature was also added to create-react-app (see discussion, implementation) pretty recently. However, that solution only passes
NODE_PATH to the generated webpack config. I’d like this to be webpack’s default behaviour 🙂
I’ve seen a few issues where adding NODE_PATH to
resolve.root (webpack v1) was suggested as a solution, but haven’t come across any discussion about whether this should be supported by default. Apologies if I’ve missed it, I’d be keen to know if this has been considered before!
Please mention other relevant information such as the browser version, Node.js version, webpack version and Operating System.
macOS Sierra 10.12.3