-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't overwrite html-webpack-plugin
hooks when using more than one instance?
#1031
Comments
We will change the hook system to avoid the behavior - you can get a first impression if you take a look at the current alpha version |
Thanks, sounds good! |
Should be fixed once #1032 is released |
Released in the current |
Currently using
|
@jamescharlesworth do you have multiple html-webpack-plugin versions in your node_modules folder? |
@jantimon yes, that looks to be the issue. My plugin had a demo folder with
Making it a peer dependency in my demo folder and removing it seems to have fixed the issue. Thank you! |
Cool 👍 |
Expected behaviour
html-webpack-plugin should probably check if the hooks already exist and not overwrite them?
html-webpack-plugin/index.js
Lines 54 to 66 in 8440e4e
...to better support multiple instances of HtmlWebpackPlugin + any plugins.
(I am not sure if there are other implications to not overwriting the hooks, as it's the first time I deep-dive into the source code of webpack plugins / html-webpack plugins.)
Current behaviour
I have spent a few hours tracking down a problem introduced by the following setup:
webpack.config.js
Where it only later became obvious that
HtmlWebpackIncludeAssetsPlugin
is bound to detached instances of the hooks that were later overwritten by the secondHtmlWebpackPlugin
.Why this was so hard to deduce is that normally if you include a plugin before
HtmlWebpackPlugin
, it will throw an error to let you know, but when the plugin is sandwiched between twoHtmlWebpackPlugin
instances, it will silently not do anything.Environment
The text was updated successfully, but these errors were encountered: