当前位置: 首页 > 后端技术 > Node.js

关于webpack4.0.0使用html-webpack-plugin错误处理方法

时间:2023-04-03 15:38:25 Node.js

报错版本:"webpack":"^4.0.0","html-webpack-plugin":"^2.30.1"使用以上版本生成html文件,构建时会出现如下错误:varoutputName=compilation.mainTemplate.applyPluginsWaterfall('asset-path',outputOptions.filename,{TypeError:compilation.mainTemplate.applyPluginsWaterfallisnotafunction查了半天代码当时,确定是版本兼容问题,在Github上也能找到答案https://github.com/jantimon/h...使用如下命令重新安装html-webpack-plugin:yarnaddwebpack-contrib/html-webpack-plugin-D方法还是有问题,执行完上面的yarn命令后,如果使用npm安装其他包,又会出现上面的错误信息,重新执行yarn命令再次关注一下这两天github上的issue,看看有没有其他的解决办法