arthurbergmz / webpack-pwa-manifest

Progressive Web App Manifest Generator for Webpack, with auto icon resizing and fingerprinting support.
MIT License
514 stars 93 forks source link

Support for upcoming html-webpack-plugin v4 #86

Open Shyiy opened 6 years ago

Shyiy commented 6 years ago

In order to support the upcoming html-webpack-plugin version 4 (for Webpack 4), the tapable.js need to be adjusted slightly. When quickly testing on my project I just modified the following to make everything work.

Add:

var HtmlWebpackPlugin = require("html-webpack-plugin");

Change 1:

if(!compilation.hooks || !compilation.hooks.htmlWebpackPluginBeforeHtmlProcessing) return
->
 if (!compilation.hooks || (!compilation.hooks.htmlWebpackPluginBeforeHtmlProcessing && !HtmlWebpackPlugin.getHooks(compilation).beforeEmit))

Change 2:

compilation.hooks.htmlWebpackPluginBeforeHtmlProcessing.tapAsync[...]
->
(compilation.hooks.htmlWebpackPluginBeforeHtmlProcessing || HtmlWebpackPlugin.getHooks(compilation).beforeEmit).tapAsync[...]