The introduction of clean-webpack-plugin package after an error in the project
new CleanWebpackPlugin(),
^
TypeError: CleanWebpackPlugin is not a constructor
Project writing:
Introducing: 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' }) ],
Looked at the wording githup, clean-webpack-plugin is now introduced a new version has been changed const
So modify the wording of the introduction to OK
const {CleanWebpackPlugin} = require('clean-webpack-plugin') plugins: [ new CleanWebpackPlugin(), new HtmlWebpackPlugin({ filename: 'index.html', template: './src/index.html' }) ],