Closed abachi closed 4 years ago
You don't miss something - with version 4.0.0 html-webpack-plugin renamed the "AfterHtmlProcessing"-hook to "beforeEmit" - that's why the handlebar-plugin breaks. The hook isn't present - so "tap" is either.
Seems the solution is stated in the blog-post: https://dev.to/jantimon/html-webpack-plugin-4-has-been-released-125d
const HtmlWebpackPlugin = require('html-webpack-plugin');
class MyPlugin {
apply (compiler) {
compiler.hooks.compilation.tap('MyPlugin', (compilation) => {
// Static Plugin interface |compilation |HOOK NAME | register listener
HtmlWebpackPlugin.getHooks(compilation).beforeEmit.tapAsync(
'MyPlugin', // <-- Set a meaningful name here for stacktraces
(data, cb) => {
// Manipulate the content
data.html += 'The Magic Footer'
// Tell webpack to move on
cb(null, data)
}
)
})
}
}
module.exports = MyPlugin
@sagold @rustyy is this issues planned to be fixed soon? Thanks :wink:
@xavierfoucrier - I don't know as I haven't contributed yet, but I may give it a try
@rustyy no problem, I am just asking to know a little bit more about the maintainability of this project.
Hi there.
A fix has been published with version 2.1.0
Thank you for your help.
@sagold & @rustyy thx! :wink:
Hello,
I am trying to use
html-webpack-plugin
withhandlebars-webpack-plugin
. when I sethtmlWebpackPlugin.enable
totrue
and compile I get the following error:
webpack.config.js
package.json
I couldn't figure out what is the problem. Am I missing something in the configuration?