Html-webpack-plugin: Plugin not functional with AggressiveSplittingPlugin plugin

Created on 6 Mar 2018  路  7Comments  路  Source: jantimon/html-webpack-plugin

As I can tell this is a long running issue (gag at this point). html-webpack-plugin doesn't work at all with AggressiveSplittingPlugin as specified in #850, #804, #738, #670, #599, and #446.

From what I can tell, chunks are being pointlessly removed because they don't have a name.

After going through the plugin and running a couple of tests I'm not even certain that using the name as the unique identifier is a good idea. That's what the hash property is for. Subsequently changing to hash seems to work fine.

Is there any reason not to use that? Cause if there isn't I'd gladly create a PR for it.

Most helpful comment

Could you please try if this works for you with 4.x alpha?

npm i html-webpack-plugin@next

All 7 comments

Webpack 4 allows us to access the chunk information using a new API:
compilation.entrypoints
Entrypoint.getChunks()
Entrypoint.getFiles()

This will hopefully allow us to get rid of the very slow compilation.getStats() call.

A basic implementation of @mike1808 can already be seen here: https://gist.github.com/mike1808/3d2ec798ab1e734b906d4e2fd34e540c

Webpack 4 allows unordered entry point execution (or basically queuing).
So we can also get rid of sorting (in most cases).

We will still need the names to filter and maybe also to sort entries like in the manual sort example
https://github.com/jantimon/html-webpack-plugin/blob/e6e84648fb3333ec072e06a9d3b1fcc7bee85440/examples/sort-manually/webpack.config.js#L27-L33

Using Webpack 4 only features forces us to drop support for Weback 1, Webpack 2 and Webpack 3. This would be a major breaking change and is already prepared on the html-webpack-plugin@4 branch.
This branch is still green for all tests but the big todo is switching to compilation.entrypoints.

@NullDivision Do you think this would also solve the issues with the AggressiveSplittingPlugin?

I saw the v4 branch. Looks awesome.

Depending on the implementation it should be fine. The issue is that AggressiveSplittingPlugin doesn't add a name to each chunk which gets filtered out by html-webpack-plugin causing the rest of the bundles to fail over as well.

@NullDivision I saw AggressiveSplittingPlugin code, and added a name for new chunks, then they can be injected into html, but code not worked either.

953 tries to solve this issue - please let me know if there are any problems with the proposed solution.

Could you please try if this works for you with 4.x alpha?

npm i html-webpack-plugin@next

I'll close this for now - if you have issues with html-webpack-plugin@next and the AgressiveSplittingPlugin please add a comment or open a new issue.

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghaiklor picture ghaiklor  路  3Comments

lcxfs1991 picture lcxfs1991  路  4Comments

hackteck picture hackteck  路  3Comments

MatthewKosloski picture MatthewKosloski  路  3Comments

lonelyclick picture lonelyclick  路  3Comments