Skip to content

Commit cf6ad23

Browse files
authored
Allow the dev server to watch for changes in src/node_modules
This allows users to put a `node_modules` folder in `src` if they want to use absolute imports or imitate the webpack `resolve.alias` config.
1 parent 3ca6bae commit cf6ad23

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/react-scripts/config/webpackDevServer.config.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,12 @@ module.exports = function(proxy, allowedHost) {
7272
// WebpackDevServer is noisy by default so we emit custom message instead
7373
// by listening to the compiler events with `compiler.plugin` calls above.
7474
quiet: true,
75-
// Reportedly, this avoids CPU overload on some systems.
75+
// Reportedly, ignoring node_modules avoids CPU overload on some systems.
7676
// https://github.com/facebookincubator/create-react-app/issues/293
77+
// src/node_modules is not ignored to support absolute imports
78+
// https://github.com/facebookincubator/create-react-app/issues/1065
7779
watchOptions: {
78-
ignored: /node_modules/,
80+
ignored: /^([^\/]|\/(?!src))*\/node_modules\//,
7981
},
8082
// Enable HTTPS if the HTTPS environment variable is set to 'true'
8183
https: protocol === 'https',

0 commit comments

Comments
 (0)