Skip to content
This repository was archived by the owner on Jan 21, 2021. It is now read-only.

compatible with html-webpack-plugin v4 hooks #81

Closed
wants to merge 2 commits into from

Conversation

arizonatribe
Copy link

Addresses this issue starting to pop up for those using the newer version (v4 beta) of Html Webpack Plugin`.

Preload Webpack Plugin depends on some hooks that are no longer placed onto the Webpack compilation object (with the "htmlWebpack" prefix), so it seems an explicit peer dependency might need to be adopted so that its new static method getHooks() can be used.

Not sure if adopting a peer dependency is the best solution or not; let me know what you think.

Thanks!

@jeffposnick
Copy link
Contributor

I've been attempting this, too, but have run into a couple of issues:

jantimon/html-webpack-plugin#1091
jantimon/html-webpack-plugin#1092

Are you sure that you aren't seeing the same problems? How are you dealing with htmlPluginData.assets.chunks going away?

@arizonatribe
Copy link
Author

That's really odd. I have a local copy of this plugin that has those PR'd changes in it; I was going to use it until you released the next version of the plugin. But I haven't encountered any problems in the past couple of weeks, and we are using chunking.

I'm just brainstorming here, but it reminds me of an issue I ran into twice in the past month (we have an ejected CRA build that we maintain in-house). The first was when we upgraded to ESLint 5 in that build but one app in particular still had an older version installed and it was forcing our eslint loader to use it, rather than v5 that was a dependency of our build tool.

The second time it happened was with a Babel plugin i forked that needed v2.5+ of core-js, but it was unintentionally getting v1.2.7 that didn't have one of the polyfills that the Babel plugin needed. Even after marking the version necessary in the dependencies wouldn't do it. Apparently one of styled-components dependencies required an older version of core-js and due to it being lower in the alphabet it's version of core-js took over the spot at the root of the node_modules/ folder. So when the Babel plugin did it's require statement it didn't find the file it needed.

For the Babel plugin i realized that the polyfills wasn't needed for browsers we're targeting. For the eslint issue I ended up changing the require statement to be more specific. I have the code now looking first for Eslint (doing a require.resolve() based off our NPM package's own node_modules/ and then falling through to a more general require of any eslint if that failed).

Maybe the latter would work though?

I'm not quite sure why I haven't run into the bug yet, but it sounds like I probably will

@jeffposnick
Copy link
Contributor

Support for html-webpack-plugin v3 + v4 was included in #72

@jeffposnick jeffposnick closed this Sep 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants