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, },