From 1e71d47feab9e267cfd0bcd5a62caf05f7c92727 Mon Sep 17 00:00:00 2001
From: Brendan McLoughlin <bmac@users.noreply.github.com>
Date: Mon, 10 Jul 2017 14:57:09 -0400
Subject: [PATCH] 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.
---
 packages/react-scripts/config/webpackDevServer.config.js | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/packages/react-scripts/config/webpackDevServer.config.js b/packages/react-scripts/config/webpackDevServer.config.js
index 2a351e668bb..27aafc71689 100644
--- a/packages/react-scripts/config/webpackDevServer.config.js
+++ b/packages/react-scripts/config/webpackDevServer.config.js
@@ -72,10 +72,12 @@ module.exports = function(proxy, allowedHost) {
     // WebpackDevServer is noisy by default so we emit custom message instead
     // by listening to the compiler events with `compiler.plugin` calls above.
     quiet: true,
-    // Reportedly, this avoids CPU overload on some systems.
+    // Reportedly, ignoring node_modules avoids CPU overload on some systems.
     // 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: {
-      ignored: /node_modules/,
+      ignored: /^([^\/\\]|[\/\\](?!src))*[\/\\]node_modules[\/\\]/,
     },
     // Enable HTTPS if the HTTPS environment variable is set to 'true'
     https: protocol === 'https',