webpack4学习之问题二

问题
E:\webpack_vue\node_modules\clean-webpack-plugin\dist\clean-webpack-plugin.js:17
throw new Error(`clean-webpack-plugin only accepts an options object. See:
^

Error: clean-webpack-plugin only accepts an options object. See:
https://github.com/johnagan/clean-webpack-plugin#options-and-defaults-optional
at new CleanWebpackPlugin (E:\webpack_vue\node_modules\clean-webpack-plugin\dist\clean-webpack-plugin.js:17:13)
at Object.<anonymous> (E:\webpack_vue\webpack.config.js:28:4)
at Module._compile (module.js:573:30)
at Object.Module._extensions..js (module.js:584:10)
at Module.load (module.js:507:32)
at tryModuleLoad (module.js:470:12)
at Function.Module._load (module.js:462:3)
at Module.require (module.js:517:17)
at require (internal/module.js:11:18)
at WEBPACK_OPTIONS (E:\webpack_vue\node_modules\webpack-cli\bin\convert-argv.js:115:13)

原因:
webpack.config.js文件的配置有问题

解决办法
webpack4关于clean-webpack-plugin的写法为:
plugins:[
new CleanWebpackPlugin(),//***
],

猜你喜欢

转载自blog.51cto.com/13249979/2375996