Skip to content

Commit 3dae2d8

Browse files
xjlimTimer
authored andcommitted
Watch for changes in src/**/node_modules (facebook#3230)
* Allow the dev server to watch for changes in src/node_modules * fix eslint error * fix broken regex * handle trailing slash edge case for file paths Closes facebook#2760 Fixes facebook#3223
1 parent 0dba748 commit 3dae2d8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Diff for: config/webpackDevServer.config.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
const errorOverlayMiddleware = require('react-dev-utils/errorOverlayMiddleware');
1212
const noopServiceWorkerMiddleware = require('react-dev-utils/noopServiceWorkerMiddleware');
13+
const path = require('path');
1314
const config = require('./webpack.config.dev');
1415
const paths = require('./paths');
1516

@@ -72,8 +73,13 @@ module.exports = function(proxy, allowedHost) {
7273
quiet: true,
7374
// Reportedly, this avoids CPU overload on some systems.
7475
// https://github.com/facebookincubator/create-react-app/issues/293
76+
// src/node_modules is not ignored to support absolute imports
77+
// https://github.com/facebookincubator/create-react-app/issues/1065
7578
watchOptions: {
76-
ignored: /node_modules/,
79+
ignored: new RegExp(
80+
`^(?!${path.normalize(paths.appSrc + '/')}).+[\\/]node_modules[\\/]`,
81+
'g'
82+
),
7783
},
7884
// Enable HTTPS if the HTTPS environment variable is set to 'true'
7985
https: protocol === 'https',

0 commit comments

Comments
 (0)