mirror of
https://github.com/elyby/accounts-frontend.git
synced 2025-01-12 23:02:16 +05:30
Fix extract css plugin
This commit is contained in:
parent
4d8704f17c
commit
f900321a12
@ -230,13 +230,25 @@ if (isAnalyze) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isProduction) {
|
if (isProduction) {
|
||||||
|
let cssExtractApplied = false;
|
||||||
|
|
||||||
webpackConfig.module.rules.forEach(rule => {
|
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`
|
// replace `style-loader` with `MiniCssExtractPlugin`
|
||||||
rule.use[0] = MiniCssExtractPlugin.loader;
|
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(
|
webpackConfig.plugins.push(
|
||||||
new MiniCssExtractPlugin({
|
new MiniCssExtractPlugin({
|
||||||
filename: '[name].css?[hash]',
|
filename: '[name].css?[hash]',
|
||||||
@ -275,9 +287,7 @@ if (isProduction) {
|
|||||||
manifest: require('./dll/vendor.json'),
|
manifest: require('./dll/vendor.json'),
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
if (!isProduction) {
|
|
||||||
webpackConfig.devServer = {
|
webpackConfig.devServer = {
|
||||||
host: 'localhost',
|
host: 'localhost',
|
||||||
port: 8080,
|
port: 8080,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user