webpack添加Cleanweb packPlugin插件,按着webpack的指南来编写会报错
TypeError: CleanWebpackPlugin is not a constructor
//webpack指南的写法 抛错 const CleanWebpackPlugin = require('clean-webpack-plugin'); ...... plugins: [ new CleanWebpackPlugin(['dist']), ], .... //正确写法 const { CleanWebpackPlugin } = require("clean-webpack-plugin"); ... plugins: [ new CleanWebpackPlugin() ] ...
以上解决方法参考了下面博主的博客
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。