mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-12-24 22:19:48 +05:30
Fix extract css plugin
This commit is contained in:
parent
4d8704f17c
commit
f900321a12
@ -230,13 +230,25 @@ if (isAnalyze) {
|
||||
}
|
||||
|
||||
if (isProduction) {
|
||||
let cssExtractApplied = false;
|
||||
|
||||
webpackConfig.module.rules.forEach(rule => {
|
||||
if (rule.use && rule.use[0] === 'style-loader') {
|
||||
if (
|
||||
rule.use &&
|
||||
(rule.use[0] === 'style-loader' || rule.use[0].loader === 'style-loader')
|
||||
) {
|
||||
// replace `style-loader` with `MiniCssExtractPlugin`
|
||||
rule.use[0] = MiniCssExtractPlugin.loader;
|
||||
cssExtractApplied = true;
|
||||
}
|
||||
});
|
||||
|
||||
if (!cssExtractApplied) {
|
||||
throw new Error(
|
||||
'Can not locate style-loader to replace it with mini-css-extract-plugin loader',
|
||||
);
|
||||
}
|
||||
|
||||
webpackConfig.plugins.push(
|
||||
new MiniCssExtractPlugin({
|
||||
filename: '[name].css?[hash]',
|
||||
@ -275,9 +287,7 @@ if (isProduction) {
|
||||
manifest: require('./dll/vendor.json'),
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
if (!isProduction) {
|
||||
webpackConfig.devServer = {
|
||||
host: 'localhost',
|
||||
port: 8080,
|
||||
|
Loading…
Reference in New Issue
Block a user