webpack4: compilation.mainTemplate.applyPluginsWaterfall is not a function 解决方法

Posted axel10

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了webpack4: compilation.mainTemplate.applyPluginsWaterfall is not a function 解决方法相关的知识,希望对你有一定的参考价值。

今天捣鼓webpack4踩到一个弥天大坑:使用html-webpack-plugin打包html的时候一直报 compilation.mainTemplate.applyPluginsWaterfall is not a function ,百度了半天没结果,谷歌一下终于在github上找到了解决方案:https://github.com/jantimon/html-webpack-plugin/issues/841

解决:先安装yarn,然后在项目跟目录下运行:

yarn add webpack-contrib/html-webpack-plugin -D

简单来说就是使用webpack官方维护的html-webpack-plugin来代替第三方的。

 

以上是关于webpack4: compilation.mainTemplate.applyPluginsWaterfall is not a function 解决方法的主要内容,如果未能解决你的问题,请参考以下文章

一行一行手敲webpack4配置

webpack4

webpack4体验

webpack4

webpack4常用片段

Webpack4篇