新版clean-webpack-plugin在使用上一共两个变化。1.不需要指定打包文件名,他会自动找output下面的配置。2.引入时需要使用一个对象去接收
- 目录展示
- 版本展示
// package.json"webpack": "^4.43.0","webpack-cli": "^3.3.11","clean-webpack-plugin": "^3.0.0",
- 导入
const { CleanWebpackPlugin} = require('clean-webpack-plugin');
- 配置
// webpack.config.jsplugins: [ new webpack.ProgressPlugin(), new CleanWebpackPlugin(), new HtmlWebpackPlugin({ template: 'index.html' })],output: { filename: 'bundle.js', path: path.resolve(__dirname, '../dist')}