Skip to content
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

HtmlWebpackPlugin Issues #1

Closed
johnstew opened this issue Mar 27, 2019 · 2 comments
Closed

HtmlWebpackPlugin Issues #1

johnstew opened this issue Mar 27, 2019 · 2 comments

Comments

@johnstew
Copy link

johnstew commented Mar 27, 2019

I'm getting a peer dep issue on yarn install. Version that's required on the peer dep is pointing to latest and greatest (>=4.0.0-alpha.2). I think the issue is with the >=. Think maybe it should be ^. Also is there a specific reason you are requiring html-webpack-plugin@4.0.0?

Also I'm getting:

HtmlWebpackPlugin.getHooks(compilation).alterAssetTagGroups.tapAsync(
                        ^
TypeError: HtmlWebpackPlugin.getHooks is not a function

So I tried cloning this down and yarn linking. I updated it to use html-webpack-plugin@^3.2.0 and that doesn't seem to work either.

Thoughts?

@JoviDeCroock
Copy link
Owner

JoviDeCroock commented Mar 27, 2019

I decided to make the first version with the non-deprecated hooks api which is only available in the alpha and beta version of that plugin.

I will support 3.0.0 if the need arises but now with webpack 5 coming up I think that hooks api will be fully deprecated. (Not entirely sure will check)

I do wonder why that is still in alpha/beta since the release of webpack 4.... Since even the owner of the html-webpack repository advices on using 4.X

The peerdep on the other hand is correct, ^ does not work to cover alpha and beta. This is also how others do it.

When you cloned it did you use the old api or? It should work with hooks but the names of the hooks are slightly different, assetGroups -> assetTagGroups and argument order changes as well.

I’ll look for the issue tonight, problem with yarn link is that it hooks into another process of html-webpack-plugin. My bad on not including these points yet in the readme.

My sincere apologies for that.

The actionpoints I can derive from this:

  • derive at the start if old or not, if old use old .hooks api.
  • remove html-webpack-plugin from dependencies and make it only a peer dependency (maybe fixes yarn link issue).
  • try to find a better way for >= with alpha and beta peerdeps.

Extra info: jantimon/html-webpack-plugin#1148 After reading this I think it's important to support the 3.X

@JoviDeCroock
Copy link
Owner

JoviDeCroock commented Mar 27, 2019

@johnstew I have released a new version that supports the html-webpack@^3. It's tagged on 0.1.0.

I have tested this with my own POC on the downgraded dependencies and it seems to work fine, let me know if you encounter any issues. Glad to help out, thanks again for the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants