Skip to content

Instantly share code, notes, and snippets.

@wongni
Last active January 11, 2018 16:09
Show Gist options
  • Save wongni/58fec55fc7318753e9c1ff9c440fd7c2 to your computer and use it in GitHub Desktop.
Save wongni/58fec55fc7318753e9c1ff9c440fd7c2 to your computer and use it in GitHub Desktop.
{
test: /\.css$/,
...
},
// Add the above block to below
{
test: /\.scss$/, // Change .css to .scss
use: [
require.resolve('style-loader'),
{
loader: require.resolve('css-loader'),
options: {
importLoaders: 1,
modules: true, // Add this option
localIdentName: '[name]__[local]__[hash:base64:5]' // Add this option
},
},
{
loader: require.resolve('postcss-loader'),
options: {
// Necessary for external CSS imports to work
// https://github.com/facebookincubator/create-react-app/issues/2677
ident: 'postcss',
plugins: () => [
require('postcss-flexbugs-fixes'),
autoprefixer({
browsers: [
'>1%',
'last 4 versions',
'Firefox ESR',
'not ie < 9', // React doesn't support IE8 anyway
],
flexbox: 'no-2009',
}),
],
},
},
// Add 'sass-loader' with includePaths
{
loader: require.resolve('sass-loader'),
options: {
includePaths: [path.styles]
}
}
],
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment