From 28f54279793356ac54a166e7c2349251dbcb18f9 Mon Sep 17 00:00:00 2001 From: Jack Zhao Date: Wed, 20 Feb 2019 13:16:18 -0800 Subject: [PATCH] revert css sourcemaps in development (#6472) This fixes #6399. --- .../react-scripts/config/webpack.config.js | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/packages/react-scripts/config/webpack.config.js b/packages/react-scripts/config/webpack.config.js index 7aaee11ccf0..a3e31b14824 100644 --- a/packages/react-scripts/config/webpack.config.js +++ b/packages/react-scripts/config/webpack.config.js @@ -108,7 +108,7 @@ module.exports = function(webpackEnv) { stage: 3, }), ], - sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment, + sourceMap: isEnvProduction && shouldUseSourceMap, }, }, ].filter(Boolean); @@ -116,7 +116,7 @@ module.exports = function(webpackEnv) { loaders.push({ loader: require.resolve(preProcessor), options: { - sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment, + sourceMap: isEnvProduction && shouldUseSourceMap, }, }); } @@ -441,9 +441,7 @@ module.exports = function(webpackEnv) { exclude: cssModuleRegex, use: getStyleLoaders({ importLoaders: 1, - sourceMap: isEnvProduction - ? shouldUseSourceMap - : isEnvDevelopment, + sourceMap: isEnvProduction && shouldUseSourceMap, }), // Don't consider CSS imports dead code even if the // containing package claims to have no side effects. @@ -457,9 +455,7 @@ module.exports = function(webpackEnv) { test: cssModuleRegex, use: getStyleLoaders({ importLoaders: 1, - sourceMap: isEnvProduction - ? shouldUseSourceMap - : isEnvDevelopment, + sourceMap: isEnvProduction && shouldUseSourceMap, modules: true, getLocalIdent: getCSSModuleLocalIdent, }), @@ -473,9 +469,7 @@ module.exports = function(webpackEnv) { use: getStyleLoaders( { importLoaders: 2, - sourceMap: isEnvProduction - ? shouldUseSourceMap - : isEnvDevelopment, + sourceMap: isEnvProduction && shouldUseSourceMap, }, 'sass-loader' ), @@ -492,9 +486,7 @@ module.exports = function(webpackEnv) { use: getStyleLoaders( { importLoaders: 2, - sourceMap: isEnvProduction - ? shouldUseSourceMap - : isEnvDevelopment, + sourceMap: isEnvProduction && shouldUseSourceMap, modules: true, getLocalIdent: getCSSModuleLocalIdent, },