From 0a93e32a434ba9995feb1a879bebf520fa6464e6 Mon Sep 17 00:00:00 2001 From: Ian Schmitz Date: Wed, 21 Oct 2020 09:56:26 -0700 Subject: [PATCH] Fix refreshOverlayInterop module scope error (#9805) --- 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 4075824d794..a33a814b472 100644 --- a/packages/react-scripts/config/webpack.config.js +++ b/packages/react-scripts/config/webpack.config.js @@ -47,6 +47,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. @@ -335,7 +338,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: { @@ -627,7 +633,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,