Always resolve NODE_PATH (#2261)

* Always resolve NODE_PATH

* Update env.js
This commit is contained in:
Dan Abramov
2017-05-19 19:55:57 +01:00
committed by GitHub
parent 3cd2267256
commit d24311ea79
4 changed files with 29 additions and 31 deletions

View File

@@ -83,11 +83,13 @@ module.exports = {
},
resolve: {
// This allows you to set a fallback for where Webpack should look for modules.
// We read `NODE_PATH` environment variable in `paths.js` and pass paths here.
// We placed these paths second because we want `node_modules` to "win"
// if there are any conflicts. This matches Node resolution mechanism.
// https://github.com/facebookincubator/create-react-app/issues/253
modules: ['node_modules', paths.appNodeModules].concat(paths.nodePaths),
modules: ['node_modules', paths.appNodeModules].concat(
// It is guaranteed to exist because we tweak it in `env.js`
process.env.NODE_PATH.split(path.delimiter)
),
// These are the reasonable defaults supported by the Node ecosystem.
// We also include JSX as a common component filename extension to support
// some tools, although we do not recommend using it, see: