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

feat(build): builds use a chunk group hash #16389

Closed

Conversation

afenton90
Copy link
Contributor

Description

webpackCompilationHash is currently used in page-data.json & HTML files to decipher whether the Gatsby app running in the browser is at the same version as the code on the server/CDN.

At the moment this hash changes if anything within ./src has changed between builds. Meaning a 404 file could be changed which would result in all page-data.json & HTML files being updated even if they have not changed between builds.

This causes some issues when using some cloud CDN providers as described in this issue #15872 .

This PR now constructs the webpackCompilationHash from hashes for each named chunk in webpack. Meaning that if a page or any associated files are changed between builds, only those files that have been updated will receive a new webpackCompilationHash, allowing for diffs to take place between what is hosted in a CDN and what is about to be pushed to a CDN.

Related Issues

closes #15872

@afenton90 afenton90 requested a review from a team as a code owner August 5, 2019 14:54
webpackCompilationHash has been replaced with a generated named chunk group hash. This reduces that
blast radius of changed built files between builds
@sidharthachatterjee
Copy link
Contributor

Needs more tests. Alex and I will be pairing on these on Tuesday!

@afenton90 afenton90 requested a review from a team as a code owner August 13, 2019 13:13
@sidharthachatterjee
Copy link
Contributor

Alex and I paired on this some more today and managed to verify the chunk hash behaviour. However, we found that there are edge cases that this doesn't currently handle:

  • First time build sometimes leaves hash set to undefined
  • Webpack runtime and app chunk are parents of every page chunk and invalidation can be problematic if the hash is not a function of them as well
@afenton90
Copy link
Contributor Author

Closing in favour of #16686

@afenton90 afenton90 closed this Aug 16, 2019
@afenton90 afenton90 deleted the topics/webpack-hash-remove branch August 16, 2019 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants