webapck将css 打包后单独提取到一个css文件中
webpack4 提倡, 一旦用了这个, 不能使用style-loader 以及css module
安装
npm install --save-dev mini-css-extract-pluginrulesrules: [ { test: /\.css$/, use: [ { loader: MiniCssExtractPlugin.loader, options: { // you can specify a publicPath here // by default it use publicPath in webpackOptions.output publicPath: '../' } }, "css-loader"] } ]plugins
new MiniCssExtractPlugin({ // Options similar to the same options in webpackOptions.output // both options are optional filename: _modeflag ? "styles/[name].[hash:5].css" : "styles/[name].css", chunkFilename: _modeflag ? "styles/[id].[hash:5].css" : "styles/[id].css" }),
相关推荐
qiupu 2020-11-04
多读书读好书 2020-11-03
RedCode 2020-10-28
jiedinghui 2020-10-25
Ladyseven 2020-10-22
hellowzm 2020-10-12
zuncle 2020-09-28
Ladyseven 2020-09-11
jiedinghui 2020-09-07
xiaohuli 2020-09-02
葉無聞 2020-09-01
impress 2020-08-26
ThikHome 2020-08-24
nicepainkiller 2020-08-20
hellowzm 2020-08-18