-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Update gatsby-plugin-netlify to allow caching JS files via HTTP headers #9245
Update gatsby-plugin-netlify to allow caching JS files via HTTP headers #9245
Conversation
this is bit confusing - we will not have |
You are right, and I completely overlooked that. Will fix and re-push! |
This commit writes regex to cache all files in the build system that are .js files and .js.map files. I am not considering caching the files in workbox because it seems like it is only useful to users of chrome?
It is important to cache workbox as they are the files that create the service workers.
Unsure why the 'no-useless-escape' is being activated, without the escape charecter non-js files with 'js' in the name are also cached. |
There is edge case that will be problematic with just caching all We will need to read webpack manifest, extract
|
@@ -26,6 +26,8 @@ export const SECURITY_HEADERS = { | |||
|
|||
export const CACHING_HEADERS = { | |||
"/static/*": [`Cache-Control: public, max-age=31536000, immutable`], | |||
"/*\.js": [`Cache-Control: public, max-age=31536000, immutable`], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are .js
files not in the static folder?
@pieh Would the list of assets found at |
Would love to get this one in! @tanvibhakta if you feel like processing this feedback that would be great. It's probably better to open up a new branch from master and try @pieh's feedback. |
This PR closes #9151
Adds a line to apply recommended caching behavior on all /src/ files in a gatsby project served on netlify, increasing cached content and therefore performance. This also makes the plugin consistent with the documentation.