1. 程式人生 > >webpack4: compilation.mainTemplate.applyPluginsWaterfall is not a function 解決方法

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

webpack class gin 安裝 fall log 大坑 谷歌 維護

今天搗鼓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 解決方法