当我们引入clean-webpack-plugin时,在WebPack构建生成的过程中可能会遇到如下报错:
TypeError: CleanWebpackPlugin is not a constructor
原因是改插件的引用方式改变了,由原来的的方式:
const CleanWebpackPlugin = require('clean-webpack-plugin');
plugins:[new CleanWebpackPlugin(['dist'])]
变成了现在的方式:
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
plugins:[new CleanWebpackPlugin()]