-
Notifications
You must be signed in to change notification settings - Fork 26.8k
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
static css chunks served with maxage=0 #5464
Comments
@timneutkens I tried to start a pull request changing css-loader-config.js lines to static/chunks (per spectrum suggestion above) but when testing, I see that the css files are being fetched twice, once from static/css and static/chunks directory. I can't quite tell what is causing the duplicate. Perhaps something in Head when fetching chunks and css needs to change too to filter out one or the other? |
Sorry, just realised this is intentional: #1791 |
Should I move this to next-plugins? |
@quietshu I am trying to make a middleware for the next.js community (https://github.com/Enalmada/next-preload-headers) that is useless without this fix. @timneutkens implied that it might be an easy fix just changing static/css to static/chunks...I tried but got some strange behavior I noted above. I am hoping that with your superior experience you might be able to immediately tell what additional thing needs to be done to fix this for good. |
I believe I have solved this bug with the following pull requests. I don't completely understand what I am doing but because this bug is hurting me I am trying to do my best. Please review: |
Part of the fix for vercel/next.js#5464 The other part is a next.js change I am checking in now. Fixes vercel/next.js#5464 Fixes #243
Part of the fix for vercel/next.js#5464 The other part is a next.js change I am checking in now. Fixes vercel/next.js#5464 Fixes #243
Part of the fix for vercel/next.js#5464 The other part is a next.js change I am checking in now. Fixes vercel/next.js#5464 Fixes #243
Bug report
Describe the bug
static css files appear to be served with sub-optimal cache-control:
/_next/static/css/commons.4e4de3e2.chunk.css
/_next/static/css/styles.4015be53.chunk.css
served with:
cache-control: public, max-age=0
I am new to Next.js behavior so apologies if this is not really a bug and css chunk shouldn't be served max-age=31536000, immutable for some reason. I just assume that the chunk hash (commons.4e4de3e2.chunk.css) ensure these things could/should be immutable but I am ready to be educated.
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
Expected behavior
I expect them to be served with "cache-control: public, max-age=31536000, immutable" like everything else in the /_next/static seems to be served with.
System information
Additional context
You can see this here: https://client.gelltest.com/
I can provide this sample repo if this for some reason isn't immediately and obviously reproducible.
(Identified after looking into css due to this comment: https://spectrum.chat/?t=9f9f43b8-ec8b-45e5-a8e3-5b57a62e9e67)
The text was updated successfully, but these errors were encountered: