From acbe8f55b243e86f8355f030f88938aa9bab4461 Mon Sep 17 00:00:00 2001 From: Jimmy Miller Date: Thu, 1 Dec 2016 15:16:20 -0500 Subject: [PATCH 1/2] Add an explicit root to webpack.resolve so it searchs there first --- packages/react-scripts/config/webpack.config.dev.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/react-scripts/config/webpack.config.dev.js b/packages/react-scripts/config/webpack.config.dev.js index 8e264d40286..21539cbed62 100644 --- a/packages/react-scripts/config/webpack.config.dev.js +++ b/packages/react-scripts/config/webpack.config.dev.js @@ -72,6 +72,7 @@ module.exports = { publicPath: publicPath }, resolve: { + root: paths.ownNodeModules, // 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 use `fallback` instead of `root` because we want `node_modules` to "win" From f3eedf09376e08e69eae7dfbe372cc8cf418a15a Mon Sep 17 00:00:00 2001 From: Jimmy Miller Date: Sun, 4 Dec 2016 15:27:26 -0500 Subject: [PATCH 2/2] Added comment and added to prod config --- packages/react-scripts/config/webpack.config.dev.js | 5 +++++ packages/react-scripts/config/webpack.config.prod.js | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/packages/react-scripts/config/webpack.config.dev.js b/packages/react-scripts/config/webpack.config.dev.js index 21539cbed62..87eba9884dd 100644 --- a/packages/react-scripts/config/webpack.config.dev.js +++ b/packages/react-scripts/config/webpack.config.dev.js @@ -72,6 +72,11 @@ module.exports = { publicPath: publicPath }, resolve: { + // This ensures that create-react-app's node_modules are first checked before + // other module locations (e.g. NODE_PATH). Without this, if NODE_PATH has + // the same module, webpack will use it before the dependency specified in our + // node modules. + // https://github.com/facebookincubator/create-react-app/issues/1023 root: paths.ownNodeModules, // 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. diff --git a/packages/react-scripts/config/webpack.config.prod.js b/packages/react-scripts/config/webpack.config.prod.js index 60016896892..4037a46c3fc 100644 --- a/packages/react-scripts/config/webpack.config.prod.js +++ b/packages/react-scripts/config/webpack.config.prod.js @@ -80,6 +80,12 @@ module.exports = { publicPath: publicPath }, resolve: { + // This ensures that create-react-app's node_modules are first checked before + // other module locations (e.g. NODE_PATH). Without this, if NODE_PATH has + // the same module, webpack will use it before the dependency specified in our + // node modules. + // https://github.com/facebookincubator/create-react-app/issues/1023 + root: paths.ownNodeModules, // 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 use `fallback` instead of `root` because we want `node_modules` to "win"