JoviDeCroock / webpack-module-nomodule-plugin

Easily implement a module nomodule index.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HtmlWebpackPlugin Issues

johnstew opened this issue · comments

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?

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

@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.