Commit 1e98d0f4 authored by Joe Lim's avatar Joe Lim Committed by Joe Haddad
Browse files

Watch for changes in `src/**/node_modules` (#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 #2760
Fixes #3223
parent c0035837
Showing with 14 additions and 4 deletions
+14 -4
...@@ -46,7 +46,7 @@ function getProcessCommand(processId, processDirectory) { ...@@ -46,7 +46,7 @@ function getProcessCommand(processId, processDirectory) {
execOptions execOptions
); );
command = command.replace(/\n$/, '') command = command.replace(/\n$/, '');
if (isProcessAReactApp(command)) { if (isProcessAReactApp(command)) {
const packageName = getPackageNameInDirectory(processDirectory); const packageName = getPackageNameInDirectory(processDirectory);
...@@ -68,8 +68,12 @@ function getProcessForPort(port) { ...@@ -68,8 +68,12 @@ function getProcessForPort(port) {
var processId = getProcessIdOnPort(port); var processId = getProcessIdOnPort(port);
var directory = getDirectoryOfProcessById(processId); var directory = getDirectoryOfProcessById(processId);
var command = getProcessCommand(processId, directory); var command = getProcessCommand(processId, directory);
return chalk.cyan(command) + chalk.grey(' (pid ' + processId + ')\n') + return (
chalk.blue(' in ') + chalk.cyan(directory); chalk.cyan(command) +
chalk.grey(' (pid ' + processId + ')\n') +
chalk.blue(' in ') +
chalk.cyan(directory)
);
} catch (e) { } catch (e) {
return null; return null;
} }
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
const errorOverlayMiddleware = require('react-dev-utils/errorOverlayMiddleware'); const errorOverlayMiddleware = require('react-dev-utils/errorOverlayMiddleware');
const noopServiceWorkerMiddleware = require('react-dev-utils/noopServiceWorkerMiddleware'); const noopServiceWorkerMiddleware = require('react-dev-utils/noopServiceWorkerMiddleware');
const path = require('path');
const config = require('./webpack.config.dev'); const config = require('./webpack.config.dev');
const paths = require('./paths'); const paths = require('./paths');
...@@ -72,8 +73,13 @@ module.exports = function(proxy, allowedHost) { ...@@ -72,8 +73,13 @@ module.exports = function(proxy, allowedHost) {
quiet: true, quiet: true,
// Reportedly, this avoids CPU overload on some systems. // Reportedly, this avoids CPU overload on some systems.
// https://github.com/facebookincubator/create-react-app/issues/293 // https://github.com/facebookincubator/create-react-app/issues/293
// src/node_modules is not ignored to support absolute imports
// https://github.com/facebookincubator/create-react-app/issues/1065
watchOptions: { watchOptions: {
ignored: /node_modules/, ignored: new RegExp(
`^(?!${path.normalize(paths.appSrc + '/')}).+[\\/]node_modules[\\/]`,
'g'
),
}, },
// Enable HTTPS if the HTTPS environment variable is set to 'true' // Enable HTTPS if the HTTPS environment variable is set to 'true'
https: protocol === 'https', https: protocol === 'https',
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment