[webpack]解决报错 CleanWebpackPlugin is not a constructor


错误写法

const CleanWebpackPlugin = require("clean-webpack-plugin");

正确写法:

let {CleanWebpackPlugin} = require('clean-webpack-plugin');

 

新版本的 clean-webpack-plugin 要通过构造函数取到包内的 CleanWebpackPlugin 方法

posted @ 2019-07-22 21:30  dellyoung  阅读(881)  评论(0编辑  收藏  举报