From b37cff94697e56a9f0d7971eb24c563f70ee311b Mon Sep 17 00:00:00 2001 From: Matt Korostoff Date: Sun, 3 May 2020 23:08:17 -0400 Subject: [PATCH] Support source maps for scss in dev environments (#8638) --- 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 30d5b82e877..8044a439b85 100644 --- a/packages/react-scripts/config/webpack.config.js +++ b/packages/react-scripts/config/webpack.config.js @@ -123,7 +123,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); @@ -132,7 +132,7 @@ module.exports = function(webpackEnv) { { loader: require.resolve('resolve-url-loader'), options: { - sourceMap: isEnvProduction && shouldUseSourceMap, + sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment, }, }, { @@ -498,7 +498,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. @@ -512,7 +512,7 @@ module.exports = function(webpackEnv) { test: cssModuleRegex, use: getStyleLoaders({ importLoaders: 1, - sourceMap: isEnvProduction && shouldUseSourceMap, + sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment, modules: { getLocalIdent: getCSSModuleLocalIdent, }, @@ -527,7 +527,7 @@ module.exports = function(webpackEnv) { use: getStyleLoaders( { importLoaders: 3, - sourceMap: isEnvProduction && shouldUseSourceMap, + sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment, }, 'sass-loader' ), @@ -544,7 +544,7 @@ module.exports = function(webpackEnv) { use: getStyleLoaders( { importLoaders: 3, - sourceMap: isEnvProduction && shouldUseSourceMap, + sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment, modules: { getLocalIdent: getCSSModuleLocalIdent, },