-
-
Notifications
You must be signed in to change notification settings - Fork 384
Non-deterministic contenthash generation #512
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
Comments
We known about non-deterministic contenthash problems due source maps, please create reproducible test repo we need investigate, maybe you faced with a new problem |
Left a comment here: #482 |
Solved for webpack@5 with and without source maps, for webpack@4 solved only without source maps (architecture problems), sorry for delay + webpack@5 generate real content hash in the production mode |
We run a Rails app that is deployed to multiple webservers. During our deploy, we build packs on each machine from the same deployed code. We have very recently encountered an issue where this process has resulted in packs with different
contenthash
fingerprints in their filename. There are only 2 CSS files in the chunk, and it seems to be an issue of the order in which those modules are hashed whencontenthash
is being calculated.Expected Behavior
Building packs for the same code on multiple machines should generate identical
contenthash
filenames.Actual Behavior
The modules associated with a chunk are hashed in a non-deterministic way, resulting in different fingerprints on different machines.
Code
How Do We Reproduce?
I'm still working on a reproducable example, but the issue appears to be the order in which
chunk.modulesIterable
returns modules here:mini-css-extract-plugin/src/index.js
Lines 227 to 231 in 1ffc393
modulesIterable
is aSortableSet
, but it appears that the code needs to explicitly callsort()
on the set to retrieve values in order. Adding a call tochunk.modulesIterable.sort()
before hashing the modules appears to be sufficient to generate a consistent fingerprint. If that seems to be a reasonable approach, I'm happy to open a PR but am struggling to put together a test for the change.The text was updated successfully, but these errors were encountered: