Skip to content

Commit

Permalink
Sass source map for dev
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuo li committed Nov 5, 2018
1 parent fbfa216 commit dc6d53b
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions packages/react-scripts/config/webpack.config.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,17 @@ const getStyleLoaders = (cssOptions, preProcessor) => {
stage: 3,
}),
],
sourceMap: true,
},
},
];
if (preProcessor) {
loaders.push(require.resolve(preProcessor));
loaders.push({
loader: require.resolve(preProcessor),
options: {
sourceMap: true,
},
});
}
return loaders;
};
Expand Down Expand Up @@ -317,6 +323,7 @@ module.exports = {
exclude: cssModuleRegex,
use: getStyleLoaders({
importLoaders: 1,
sourceMap: true,
}),
},
// Adds support for CSS Modules (https://github.com/css-modules/css-modules)
Expand All @@ -327,6 +334,7 @@ module.exports = {
importLoaders: 1,
modules: true,
getLocalIdent: getCSSModuleLocalIdent,
sourceMap: true,
}),
},
// Opt-in support for SASS (using .scss or .sass extensions).
Expand All @@ -337,7 +345,13 @@ module.exports = {
{
test: sassRegex,
exclude: sassModuleRegex,
use: getStyleLoaders({ importLoaders: 2 }, 'sass-loader'),
use: getStyleLoaders(
{
importLoaders: 2,
sourceMap: true,
},
'sass-loader'
),
},
// Adds support for CSS Modules, but using SASS
// using the extension .module.scss or .module.sass
Expand All @@ -348,6 +362,7 @@ module.exports = {
importLoaders: 2,
modules: true,
getLocalIdent: getCSSModuleLocalIdent,
sourceMap: true,
},
'sass-loader'
),
Expand Down

0 comments on commit dc6d53b

Please sign in to comment.