使用CleanWebpackPlugin插件报错原因:CleanWebpackPlugin is not a constructor
Posted Nayek
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用CleanWebpackPlugin插件报错原因:CleanWebpackPlugin is not a constructor相关的知识,希望对你有一定的参考价值。
1 // webpack版本:4.32.2 2 3 // 抛错原写法 4 const CleanWebpackPlugin = require("clean-webpack-plugin"); 5 6 ... 7 8 plugins: [ 9 new CleanWebpackPlugin([‘dist‘]) 10 ] 11 12 ... 13 14 // 另一种错误写法 15 16 const CleanWebpackPlugin = require("clean-webpack-plugin"); 17 18 ... 19 20 plugins: [ 21 new CleanWebpackPlugin([‘dist‘], { 22 root: path.resolve(__dirname, ‘../‘), //根目录 23 }) 24 ] 25 26 ... 27 28 // =============================分割线============================== 29 30 // 正确写法 31 32 const { CleanWebpackPlugin } = require("clean-webpack-plugin"); 33 34 ... 35 36 plugins: [ 37 new CleanWebpackPlugin() 38 ] 39 40 ...
以上是关于使用CleanWebpackPlugin插件报错原因:CleanWebpackPlugin is not a constructor的主要内容,如果未能解决你的问题,请参考以下文章
CleanWebpackPlugin is not a constructor
webpack报错:' CleanWebpackPlugin is not a constructor'
spring “The matching wildcard is strict, but no declaration can be found for element”报错原