webpack5报错: TypeError: The 'compilation' argument must be an instance of Compilation

似乎是webpack5和HtmlWebpackPlugin的兼容性问题

Webpack 5: The ‘compilation‘ argument must be an instance of Compilation_webpack

解决办法可以安装4.X的wepback,或是安装5.X的html-webpack-plugin

Webpack 5: The ‘compilation‘ argument must be an instance of Compilation_compilation_02

没有最新的 5.x版本,只能安装5.0.0-alpha

安装: npm install html-webpack-plugin@5.0.0-alpha.14 --save-dev