主要是使用clean-webpack-plugin引發的錯誤
webpack
1.這麼寫就會就會引起第一個問題,是因爲引入版本比較高致使的npm install clean-webpack-plugin --save-dev
+ const CleanWebpackPlugin = require('clean-webpack-plugin'); plugins: [ + new CleanWebpackPlugin(['dist']), new HtmlWebpackPlugin({ title: 'Output Management' }) ]
這個錯誤告訴咱們導入的類型不對,須要修改,給導入行加大括號解決web
+ const {CleanWebpackPlugin} = require('clean-webpack-plugin'); plugins: [ + new CleanWebpackPlugin(['dist']), new HtmlWebpackPlugin({ title: 'Output Management' }) ]
2.而後運行還會引起第二個錯誤,這個錯誤告訴咱們使用這個類參數得是一個對象
其實不填也能夠,填一個空的{}也行,清除的目錄會默認以輸出口目錄爲準npm
const {CleanWebpackPlugin} = require('clean-webpack-plugin'); plugins: [ new CleanWebpackPlugin(), new HtmlWebpackPlugin({ title: 'Output Management' }) ],