Last active
March 4, 2021 08:04
-
-
Save Katerina198b/55ebc35d6e41396ff63c482fb5dc5b4b to your computer and use it in GitHub Desktop.
webpack.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const postcssLoader = { | |
loader: 'postcss-loader', | |
options: { | |
sourceMap: false, | |
plugins: () => [autoprefixer()], | |
}, | |
}; | |
const cssRules = [ | |
{ | |
// for css files that are imported WITHOUT modules | |
test: /\.(s?css)$/, | |
use: [ | |
//extracts CSS into separate files | |
MiniCssExtractPlugin.loader, | |
{ | |
loader: 'css-loader', | |
options: { | |
modules: false, | |
} | |
}, | |
//autoprefixer | |
postcssLoader, | |
'sass-loader' | |
], | |
sideEffects: true, | |
//file listing | |
include: /(bootstrap|date)\.scss$/, | |
}, | |
{ | |
test: /\.(s?css)$/, | |
use: [ | |
MiniCssExtractPlugin.loader, | |
{ | |
loader: 'css-loader', | |
options: { | |
modules: true, | |
exportOnlyLocals: false, | |
getLocalIdent: (context, localIdentName, localName) => { | |
return generateScopedName(localName, context.resourcePath); | |
}, | |
} | |
}, | |
postcssLoader, | |
'sass-loader' | |
], | |
sideEffects: true, | |
exclude: /(bootstrap|date)\.scss$/, | |
}, | |
]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment