TypeError: CleanWebpackPlugin is not a constructor
生活随笔
收集整理的这篇文章主要介绍了
TypeError: CleanWebpackPlugin is not a constructor
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
在项目中引入clean-webpack-plugin打包后报错
new CleanWebpackPlugin(),
^
TypeError: CleanWebpackPlugin is not a constructor
项目写法: 引入: cnpm i clean-webpack-plugin -D webpack.config.js中 const CleanWebpackPlugin = require('clean-webpack-plugin')plugins: [new CleanWebpackPlugin(),new HtmlWebpackPlugin({filename: 'index.html',template: './src/index.html'}) ],看了一下githup上的写法,现在新版本的clean-webpack-plugin引入已经改为const
所以修改引入写法就OK了
const {CleanWebpackPlugin} = require('clean-webpack-plugin')plugins: [new CleanWebpackPlugin(),new HtmlWebpackPlugin({filename: 'index.html',template: './src/index.html'}) ],
转载于:https://www.cnblogs.com/steamed-twisted-roll/p/10990309.html
总结
以上是生活随笔为你收集整理的TypeError: CleanWebpackPlugin is not a constructor的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: 转载:JAVA 操作 Ant API
- 下一篇: Nacos 发布 1.0.0 GA 版本