From d70df80b36c39b867f89517b24266277b7185de6 Mon Sep 17 00:00:00 2001 From: Ian Schmitz Date: Wed, 14 Oct 2020 11:23:41 -0700 Subject: [PATCH] Fix refreshOverlayInterop module scope error --- packages/react-scripts/config/webpack.config.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/react-scripts/config/webpack.config.js b/packages/react-scripts/config/webpack.config.js index bb506bbf446..e67c16162b6 100644 --- a/packages/react-scripts/config/webpack.config.js +++ b/packages/react-scripts/config/webpack.config.js @@ -48,6 +48,9 @@ const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false'; const webpackDevClientEntry = require.resolve( 'react-dev-utils/webpackHotDevClient' ); +const reactRefreshOverlayEntry = require.resolve( + 'react-dev-utils/refreshOverlayInterop' +); // Some apps do not need the benefits of saving a web request, so not inlining the chunk // makes for a smoother build process. @@ -336,7 +339,10 @@ module.exports = function (webpackEnv) { // To fix this, we prevent you from importing files out of src/ -- if you'd like to, // please link the files into your node_modules/ and let module-resolution kick in. // Make sure your source files are compiled, as they will not be processed in any way. - new ModuleScopePlugin(paths.appSrc, [paths.appPackageJson]), + new ModuleScopePlugin(paths.appSrc, [ + paths.appPackageJson, + reactRefreshOverlayEntry, + ]), ], }, resolveLoader: { @@ -649,7 +655,7 @@ module.exports = function (webpackEnv) { entry: webpackDevClientEntry, // The expected exports are slightly different from what the overlay exports, // so an interop is included here to enable feedback on module-level errors. - module: require.resolve('react-dev-utils/refreshOverlayInterop'), + module: reactRefreshOverlayEntry, // Since we ship a custom dev client and overlay integration, // the bundled socket handling logic can be eliminated. sockIntegration: false,