css代码提取后想要压缩 —— 使用css-minimizer-webpack-plugin插件
- 下载 css-minimizer-webpack-plugin 本地软件包
npm install css-minimizer-webpack-plugin --save-dev
- 配置 webpack.config.js 让webpack拥有该功能
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
optimization: {
minimizer: [
//原本压缩的js优化功能留在原地
`...`,
new CssMinimizerPlugin(),
],
},