Skip to content

Plugin not functional with AggressiveSplittingPlugin plugin #889

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

Closed
NullDivision opened this issue Mar 6, 2018 · 7 comments
Closed

Plugin not functional with AggressiveSplittingPlugin plugin #889

NullDivision opened this issue Mar 6, 2018 · 7 comments

Comments

@NullDivision
Copy link

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.

@jantimon
Copy link
Owner

jantimon commented Mar 20, 2018

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

new HtmlWebpackPlugin({
inject: true,
filename: 'first-file.html',
template: 'template.html',
chunksSortMode: 'manual',
chunks: ['a', 'b', 'c']
}),

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?

@NullDivision
Copy link
Author

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.

@BleemIs42
Copy link

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

@jantimon
Copy link
Owner

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

@jantimon
Copy link
Owner

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

npm i html-webpack-plugin@next

@jantimon
Copy link
Owner

jantimon commented Jun 4, 2018

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.

@jantimon jantimon closed this as completed Jun 4, 2018
@lock
Copy link

lock bot commented Jul 4, 2018

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.

@lock lock bot locked as resolved and limited conversation to collaborators Jul 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants