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

fix: apply caching headers to all produced assets #217

Merged
merged 2 commits into from Mar 8, 2023

Conversation

pieh
Copy link
Contributor

@pieh pieh commented Feb 8, 2023

Port of gatsbyjs/gatsby#35494

This adds missing permament caching headers on some assets that are emitted by webpack. In particular this adds those headers to chunk files that were code split due to dynamic imports (import('something')) - those are not handled with current implementation and result in default (?) cache-control: public, max-age=0, must-revalidate.

You can compare results (visit, refresh, check network tab in DevTools) :
latest: https://63e388514621dd00b6e20e73--jade-bavarois-301e6e.netlify.app/dynamic/
with changes from this pr: https://63e3c8f45bb3b000084802c9--jade-bavarois-301e6e.netlify.app/dynamic/

(left = latest, right = this pr)
image

Not every site will see benefits, but users of @loadable/component etc will by saving on unnecessary round trips to server (304s) if resource is already cached by the browser

@pieh pieh requested a review from a team February 8, 2023 16:39
@github-actions github-actions bot added the type: bug code to address defects in shipped code label Feb 8, 2023
@kodiakhq kodiakhq bot merged commit 31e9249 into main Mar 8, 2023
@kodiakhq kodiakhq bot deleted the fix/apply-caching-headers-to-all-webpack-assets branch March 8, 2023 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge type: bug code to address defects in shipped code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants