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

Chunkhash in filename still differs #7

Open
alexhancock opened this issue Jul 30, 2015 · 9 comments
Open

Chunkhash in filename still differs #7

alexhancock opened this issue Jul 30, 2015 · 9 comments

Comments

@alexhancock
Copy link

This plugin works great, thanks for writing it.

I'm experiencing an issue where the contents of a commons chunk are now identical across compiles where the only code changed is not in the commons chunk, but the chunkHash webpack outputs for the commons chunk filename is still different.

Anyone else ever run into this?

@alexhancock
Copy link
Author

(This may totally be an issue in webpack itself, I just thought I would post an issue here as the likelihood someone looking at this repo has run into this problem is higher than webpack repo itself)

@kevinrenskers
Copy link

I just created this issue: webpack/webpack#1315. Has an example as well: https://github.com/kevinrenskers/chunkhash-problem.

@alexhancock
Copy link
Author

Cool - glad to see I'm not alone.

I'll follow that thread and this one to see if anyone has relevant knowledge towards cause or a fix.

@bholloway
Copy link

+1

@bholloway
Copy link

Is this still a pain point for others?

I found a solution that works for my use-case. I will raise a PR so @diurnalist and others can critique. But tomorrow after sleep.

@bholloway
Copy link

So at startup WebpackOptionsApply adds a lot of default plugins. One of them is TemplatedPathPlugin, at WebpackOptionsApply.js#L266.

Noting that MainTemplate is the implementation of compilation.mainTemplate the MainTemplate.updateHashForChunk() routine will determine the hash of the entry chunk. It exposes a "hash-for-chunk" extensibility point which is hooked by TemplatedPathPlugin.

The problem is that TemplatedPathPlugin adds the hashes of other chunks into the digest. I believe this is on the presumption that the entry chunk will contain the chunk manifest. The hashing routine is not a pure function so simply adding another "hash-for-chunk" routine will not undo the effects of TemplatedPathPlugin.

I am proposing a monkey-patch of MainTemplate.updateHashForChunk() such that it does not call the "hash-for-chunk" extensibility point. This is working for my use-case (sorry closed source). I am interested whether this solves the problem for @alexhancock and @kevinrenskers.

You can install from bholloway/chunk-manifest-webpack-plugin and I have PR #9.

Additionally, let me know if this is relevant to webpack/webpack#1315.

@bholloway
Copy link

This issue should be closed based on the response to the question I posed.

Essentially if you use webpack-md5-hash plugin the problem goes away.

Refer to webpack/webpack#1315 for a full solution.

@gingur
Copy link
Contributor

gingur commented Mar 16, 2016

Using the md5hash plugin still having an issue with naming of the chunks; PR #11

@gingur
Copy link
Contributor

gingur commented Mar 22, 2016

knock knock

JeremyBernier added a commit to JeremyBernier/chunk-manifest-webpack-plugin that referenced this issue Aug 3, 2016
If a plugin requires another dependency to work, then this should be mentioned in the readme.

soundcloud#7
JeremyBernier added a commit to JeremyBernier/chunk-manifest-webpack-plugin that referenced this issue Aug 3, 2016
If a plugin requires another dependency to work, then this should be mentioned in the readme.

soundcloud#7
JeremyBernier added a commit to JeremyBernier/chunk-manifest-webpack-plugin that referenced this issue Aug 3, 2016
If a plugin requires another dependency to work, then this should be mentioned in the readme.

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

No branches or pull requests

4 participants