Skip to content

Commit e62e2b2

Browse files
author
matar
committedAug 5, 2017
sass-loader
1 parent fa8c8fb commit e62e2b2

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed
 

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

+14
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,20 @@ module.exports = {
220220
},
221221
],
222222
},
223+
{
224+
test: /\.scss$/,
225+
use: [
226+
'style-loader',
227+
// Using source maps breaks urls in the CSS loader
228+
// https://github.com/webpack/css-loader/issues/232
229+
// This comment solves it, but breaks testing from a local network
230+
// https://github.com/webpack/css-loader/issues/232#issuecomment-240449998
231+
// 'css-loader?sourceMap',
232+
'css-loader?importLoaders=1&modules&localIdentName=[path]___[name]__[local]___[hash:base64:5]',
233+
'postcss-loader',
234+
'sass-loader',
235+
],
236+
},
223237
// "file" loader makes sure those assets get served by WebpackDevServer.
224238
// When you `import` an asset, you get its (virtual) filename.
225239
// In production, they would get copied to the `build` folder.

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

+7
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,13 @@ module.exports = {
235235
),
236236
// Note: this won't work without `new ExtractTextPlugin()` in `plugins`.
237237
},
238+
{
239+
test: /\.scss$/,
240+
loader: ExtractTextPlugin.extract({
241+
fallbackLoader: 'style-loader',
242+
loader: 'css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!postcss-loader!sass-loader',
243+
}),
244+
},
238245
// "file" loader makes sure assets end up in the `build` folder.
239246
// When you `import` an asset, you get its filename.
240247
// This loader don't uses a "test" so it will catch all modules

‎packages/react-scripts/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,14 @@
4444
"fs-extra": "3.0.1",
4545
"html-webpack-plugin": "2.29.0",
4646
"jest": "20.0.4",
47+
"node-sass": "^4.5.3",
4748
"object-assign": "4.1.1",
4849
"postcss-flexbugs-fixes": "3.0.0",
4950
"postcss-loader": "2.0.6",
5051
"promise": "7.1.1",
5152
"react-dev-utils": "^3.0.2",
5253
"react-error-overlay": "^1.0.9",
54+
"sass-loader": "^6.0.6",
5355
"style-loader": "0.18.2",
5456
"sw-precache-webpack-plugin": "0.11.3",
5557
"url-loader": "0.5.9",

0 commit comments

Comments
 (0)
Please sign in to comment.