Skip to content

Commit 18d5e87

Browse files
alicialicsJack Zhao
authored and
Jack Zhao
committed
Sass source map for dev (#5713)
Sass source map for dev
1 parent 817ecb1 commit 18d5e87

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

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

+14-6
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,
111+
sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment,
112112
},
113113
},
114114
].filter(Boolean);
115115
if (preProcessor) {
116116
loaders.push({
117117
loader: require.resolve(preProcessor),
118118
options: {
119-
sourceMap: isEnvProduction && shouldUseSourceMap,
119+
sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment,
120120
},
121121
});
122122
}
@@ -441,7 +441,9 @@ module.exports = function(webpackEnv) {
441441
exclude: cssModuleRegex,
442442
use: getStyleLoaders({
443443
importLoaders: 1,
444-
sourceMap: isEnvProduction && shouldUseSourceMap,
444+
sourceMap: isEnvProduction
445+
? shouldUseSourceMap
446+
: isEnvDevelopment,
445447
}),
446448
// Don't consider CSS imports dead code even if the
447449
// containing package claims to have no side effects.
@@ -455,7 +457,9 @@ module.exports = function(webpackEnv) {
455457
test: cssModuleRegex,
456458
use: getStyleLoaders({
457459
importLoaders: 1,
458-
sourceMap: isEnvProduction && shouldUseSourceMap,
460+
sourceMap: isEnvProduction
461+
? shouldUseSourceMap
462+
: isEnvDevelopment,
459463
modules: true,
460464
getLocalIdent: getCSSModuleLocalIdent,
461465
}),
@@ -469,7 +473,9 @@ module.exports = function(webpackEnv) {
469473
use: getStyleLoaders(
470474
{
471475
importLoaders: 2,
472-
sourceMap: isEnvProduction && shouldUseSourceMap,
476+
sourceMap: isEnvProduction
477+
? shouldUseSourceMap
478+
: isEnvDevelopment,
473479
},
474480
'sass-loader'
475481
),
@@ -486,7 +492,9 @@ module.exports = function(webpackEnv) {
486492
use: getStyleLoaders(
487493
{
488494
importLoaders: 2,
489-
sourceMap: isEnvProduction && shouldUseSourceMap,
495+
sourceMap: isEnvProduction
496+
? shouldUseSourceMap
497+
: isEnvDevelopment,
490498
modules: true,
491499
getLocalIdent: getCSSModuleLocalIdent,
492500
},

0 commit comments

Comments
 (0)