From 62e8e3d5c446f25985b829ad2a67b1e344f6fedd Mon Sep 17 00:00:00 2001 From: Tan Li Hau Date: Tue, 5 May 2020 00:30:12 +0800 Subject: [PATCH] fix react-refresh babel plugin not applied (#8952) --- .../react-scripts/config/webpack.config.js | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/packages/react-scripts/config/webpack.config.js b/packages/react-scripts/config/webpack.config.js index 8044a439b85..fc0745da43d 100644 --- a/packages/react-scripts/config/webpack.config.js +++ b/packages/react-scripts/config/webpack.config.js @@ -433,11 +433,11 @@ module.exports = function(webpackEnv) { }, }, }, - isEnvDevelopment && - shouldUseReactRefresh && - require.resolve('react-refresh/babel'), - ].filter(Boolean), - ], + ], + isEnvDevelopment && + shouldUseReactRefresh && + require.resolve('react-refresh/babel'), + ].filter(Boolean), // This is a feature of `babel-loader` for webpack (not Babel itself). // It enables caching results in ./node_modules/.cache/babel-loader/ // directory for faster rebuilds. @@ -498,7 +498,9 @@ module.exports = function(webpackEnv) { exclude: cssModuleRegex, use: getStyleLoaders({ importLoaders: 1, - sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment, + sourceMap: isEnvProduction + ? shouldUseSourceMap + : isEnvDevelopment, }), // Don't consider CSS imports dead code even if the // containing package claims to have no side effects. @@ -512,7 +514,9 @@ module.exports = function(webpackEnv) { test: cssModuleRegex, use: getStyleLoaders({ importLoaders: 1, - sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment, + sourceMap: isEnvProduction + ? shouldUseSourceMap + : isEnvDevelopment, modules: { getLocalIdent: getCSSModuleLocalIdent, }, @@ -527,7 +531,9 @@ module.exports = function(webpackEnv) { use: getStyleLoaders( { importLoaders: 3, - sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment, + sourceMap: isEnvProduction + ? shouldUseSourceMap + : isEnvDevelopment, }, 'sass-loader' ), @@ -544,7 +550,9 @@ module.exports = function(webpackEnv) { use: getStyleLoaders( { importLoaders: 3, - sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment, + sourceMap: isEnvProduction + ? shouldUseSourceMap + : isEnvDevelopment, modules: { getLocalIdent: getCSSModuleLocalIdent, },