关于webpack使用清除插件出现 TypeError: CleanWebpackPlugin is not a constructor

在新版本webpack4.使用清除插件出现问题:

 

由于现在新版本的 clean-webpack-plugin 插件引入已经改为const CleanWebpackPlugin require('clean-webpack-plugin');

所以使用webpack中文网上的例子时会报错;

原写法:

更改后写法:

 

 

这里不用指向dist ;效果一样;

 

posted @ 2019-07-05 17:39  抹茶奶盖xh  阅读(4078)  评论(1)    收藏  举报