Skip to content

Commit 28f5427

Browse files
Jack ZhaoTimer
Jack Zhao
authored andcommitted
revert css sourcemaps in development (#6472)
This fixes #6399.
1 parent d57fd37 commit 28f5427

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

packages/react-scripts/config/webpack.config.js

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,15 @@ module.exports = function(webpackEnv) {
108108
stage: 3,
109109
}),
110110
],
111-
sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment,
111+
sourceMap: isEnvProduction && shouldUseSourceMap,
112112
},
113113
},
114114
].filter(Boolean);
115115
if (preProcessor) {
116116
loaders.push({
117117
loader: require.resolve(preProcessor),
118118
options: {
119-
sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment,
119+
sourceMap: isEnvProduction && shouldUseSourceMap,
120120
},
121121
});
122122
}
@@ -441,9 +441,7 @@ module.exports = function(webpackEnv) {
441441
exclude: cssModuleRegex,
442442
use: getStyleLoaders({
443443
importLoaders: 1,
444-
sourceMap: isEnvProduction
445-
? shouldUseSourceMap
446-
: isEnvDevelopment,
444+
sourceMap: isEnvProduction && shouldUseSourceMap,
447445
}),
448446
// Don't consider CSS imports dead code even if the
449447
// containing package claims to have no side effects.
@@ -457,9 +455,7 @@ module.exports = function(webpackEnv) {
457455
test: cssModuleRegex,
458456
use: getStyleLoaders({
459457
importLoaders: 1,
460-
sourceMap: isEnvProduction
461-
? shouldUseSourceMap
462-
: isEnvDevelopment,
458+
sourceMap: isEnvProduction && shouldUseSourceMap,
463459
modules: true,
464460
getLocalIdent: getCSSModuleLocalIdent,
465461
}),
@@ -473,9 +469,7 @@ module.exports = function(webpackEnv) {
473469
use: getStyleLoaders(
474470
{
475471
importLoaders: 2,
476-
sourceMap: isEnvProduction
477-
? shouldUseSourceMap
478-
: isEnvDevelopment,
472+
sourceMap: isEnvProduction && shouldUseSourceMap,
479473
},
480474
'sass-loader'
481475
),
@@ -492,9 +486,7 @@ module.exports = function(webpackEnv) {
492486
use: getStyleLoaders(
493487
{
494488
importLoaders: 2,
495-
sourceMap: isEnvProduction
496-
? shouldUseSourceMap
497-
: isEnvDevelopment,
489+
sourceMap: isEnvProduction && shouldUseSourceMap,
498490
modules: true,
499491
getLocalIdent: getCSSModuleLocalIdent,
500492
},

0 commit comments

Comments
 (0)