Skip to content

Commit 4d4262a

Browse files
committed
【update】mini-css-extract-plugin
1 parent 19db4c3 commit 4d4262a

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

build/webpack.config.base.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const webpack = require('webpack');
2-
const ExtractTextPlugin = require('extract-text-webpack-plugin');
2+
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
33
const ESLintPlugin = require('eslint-webpack-plugin');
44
const pkg = require('../package.json');
55

@@ -24,7 +24,8 @@ module.exports = {
2424

2525
//是否启用压缩
2626
optimization: {
27-
minimize: false
27+
minimize: false,
28+
noEmitOnErrors: true
2829
},
2930
//不显示打包文件大小相关警告
3031
performance: {
@@ -58,11 +59,7 @@ module.exports = {
5859
},
5960
css: {
6061
test: /\.css$/,
61-
use: ExtractTextPlugin.extract({
62-
use: {
63-
loader: 'css-loader'
64-
}
65-
})
62+
use: [MiniCssExtractPlugin.loader, 'css-loader']
6663
}
6764
}
6865
},
@@ -79,8 +76,7 @@ module.exports = {
7976
plugins: function (libName, productName) {
8077
return [
8178
new webpack.BannerPlugin(this.bannerInfo(productName)),
82-
new ExtractTextPlugin(`./${productName}.css`),
83-
new webpack.NoEmitOnErrorsPlugin(),
79+
new MiniCssExtractPlugin({filename:`./${productName}.css`}),
8480
new ESLintPlugin({ failOnError: true, files: 'src' })
8581
];
8682
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@
7979
"eslint-plugin-import": "^2.22.1",
8080
"eslint-webpack-plugin": "^2.1.0",
8181
"express": "^4.16.3",
82-
"extract-text-webpack-plugin": "^4.0.0-beta.0",
8382
"get-pixels": "^3.3.0",
8483
"image-size": "^0.9.1",
8584
"istanbul": "^0.4.5",
@@ -93,6 +92,7 @@
9392
"karma-jasmine": "^3.3.1",
9493
"karma-sonarqube-unit-reporter": "0.0.21",
9594
"karma-teamcity-reporter": "^1.1.0",
95+
"mini-css-extract-plugin": "^1.0.0",
9696
"mock-socket": "^9.0.2",
9797
"nightwatch": "^1.3.1",
9898
"open": "^7.0.0",

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy