学习webpack4的坑

安装 清理 /dist 文件夹 的插件

clean-webpack-plugin

官网没有更新教程 直接按照官方教程会报错:

TypeError: CleanWebpackPlugin is not a constructor
//官方错误写法:
const CleanWebpackPlugin = require('clean-webpack-plugin');
//更新后正确写法:
const {CleanWebpackPlugin} = require('clean-webpack-plugin')
//官方错误写法:
new CleanWebpackPlugin(['dist']),
//更新后正确写法:
new CleanWebpackPlugin(),

你可能感兴趣的:(学习webpack4的坑)