clean-webpack-plugin only accepts an options object
webpack 打包过程中出现 clean-webpack-plugin only accepts an options object 错误
clean-webpack-plugin 作用: 清除构建文件夹的 webpack 插件(也就是项目中 dist 文件夹工具)
如何造成这个错误: 版本升级导致
// 笔者使用版本
clean-webpack-plugin: ^2.0.1,
错误写法:
正确写法:
原因: 默认情况下,clean-webpack-plugin 将删除webpack的output.path目录中的所有文件,以及每次成功重建后所有未使用的webpack资产。
总结: 插件越升级越省事