From f12c19f018ff70ad5877c5fad1fbc926de5cb2b2 Mon Sep 17 00:00:00 2001 From: Matt Korostoff Date: Wed, 11 Mar 2020 17:33:44 -0400 Subject: [PATCH] Support source maps for scss in dev environments --- packages/react-scripts/config/webpack.config.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/react-scripts/config/webpack.config.js b/packages/react-scripts/config/webpack.config.js index 25840d91148..b361d41a642 100644 --- a/packages/react-scripts/config/webpack.config.js +++ b/packages/react-scripts/config/webpack.config.js @@ -115,7 +115,7 @@ module.exports = function(webpackEnv) { // which in turn let's users customize the target behavior as per their needs. postcssNormalize(), ], - sourceMap: isEnvProduction && shouldUseSourceMap, + sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment, }, }, ].filter(Boolean); @@ -124,7 +124,7 @@ module.exports = function(webpackEnv) { { loader: require.resolve('resolve-url-loader'), options: { - sourceMap: isEnvProduction && shouldUseSourceMap, + sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment, }, }, { @@ -481,7 +481,7 @@ module.exports = function(webpackEnv) { exclude: cssModuleRegex, use: getStyleLoaders({ importLoaders: 1, - sourceMap: isEnvProduction && shouldUseSourceMap, + sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment, }), // Don't consider CSS imports dead code even if the // containing package claims to have no side effects. @@ -495,7 +495,7 @@ module.exports = function(webpackEnv) { test: cssModuleRegex, use: getStyleLoaders({ importLoaders: 1, - sourceMap: isEnvProduction && shouldUseSourceMap, + sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment, modules: { getLocalIdent: getCSSModuleLocalIdent, }, @@ -510,7 +510,7 @@ module.exports = function(webpackEnv) { use: getStyleLoaders( { importLoaders: 3, - sourceMap: isEnvProduction && shouldUseSourceMap, + sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment, }, 'sass-loader' ), @@ -527,7 +527,7 @@ module.exports = function(webpackEnv) { use: getStyleLoaders( { importLoaders: 3, - sourceMap: isEnvProduction && shouldUseSourceMap, + sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment, modules: { getLocalIdent: getCSSModuleLocalIdent, },