Skip to content

Commit

Permalink
Sass source map for dev (#5713)
Browse files Browse the repository at this point in the history
Sass source map for dev
  • Loading branch information
alicialics authored and Jack Zhao committed Feb 8, 2019
1 parent 817ecb1 commit 18d5e87
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions packages/react-scripts/config/webpack.config.js
Expand Up @@ -108,15 +108,15 @@ module.exports = function(webpackEnv) {
stage: 3,
}),
],
sourceMap: isEnvProduction && shouldUseSourceMap,
sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment,
},
},
].filter(Boolean);
if (preProcessor) {
loaders.push({
loader: require.resolve(preProcessor),
options: {
sourceMap: isEnvProduction && shouldUseSourceMap,
sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment,
},
});
}
Expand Down Expand Up @@ -441,7 +441,9 @@ 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.
Expand All @@ -455,7 +457,9 @@ module.exports = function(webpackEnv) {
test: cssModuleRegex,
use: getStyleLoaders({
importLoaders: 1,
sourceMap: isEnvProduction && shouldUseSourceMap,
sourceMap: isEnvProduction
? shouldUseSourceMap
: isEnvDevelopment,
modules: true,
getLocalIdent: getCSSModuleLocalIdent,
}),
Expand All @@ -469,7 +473,9 @@ module.exports = function(webpackEnv) {
use: getStyleLoaders(
{
importLoaders: 2,
sourceMap: isEnvProduction && shouldUseSourceMap,
sourceMap: isEnvProduction
? shouldUseSourceMap
: isEnvDevelopment,
},
'sass-loader'
),
Expand All @@ -486,7 +492,9 @@ module.exports = function(webpackEnv) {
use: getStyleLoaders(
{
importLoaders: 2,
sourceMap: isEnvProduction && shouldUseSourceMap,
sourceMap: isEnvProduction
? shouldUseSourceMap
: isEnvDevelopment,
modules: true,
getLocalIdent: getCSSModuleLocalIdent,
},
Expand Down

0 comments on commit 18d5e87

Please sign in to comment.