-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
5.4.3 production bug #18038
Comments
A solution to force cache invalidation is to change the CSS asset file name using the following options: For example, notice the build: {
rollupOptions: {
output: {
assetFileNames: (chunkInfo) => {
// https://github.com/vitejs/vite/issues/18038
if (chunkInfo.name?.endsWith(".css")) {
return "assets/[name]-[hash]0[extname]";
}
return "assets/[name]-[hash][extname]";
},
},
},
}, |
We also encountered this issue this morning. Thankfully, downgrading to 5.4.2 fixed this for us also 👍 |
@georgemincof @seanogdev Would you try 5.4.5+? A related fix has been included. |
@sapphi-red We ran into a production outage yesterday after updating from vite 5.2.8 to 5.4.6, because of this change in behavior. Users who had dynamically imported css chunks cached would crash with From what I can tell the fix in 5.4.5 only applies to vite:preloadError, which doesn't really help us since reloading the page won't make a difference as long as the chunk has the same URI, which is the case for us. We'll probably have to invalidate the cache by temporarily changing the css chunk filename as suggested above. |
Right... the real problem here is the "crossorigin" attribute. The issue that preload brings is more of a side effect. In conclusion, I believe this can be closed, as the fix that worked for us should address the issue for the majority. It's not that big of a problem... |
Its not a big problem no 👍 It is just a bit cumbersome to have to modify the asset hash function in vite due to a patch version, a lot of our css files dont change that often so this vite config change will need to stay for the foreseeable. |
I had production outage after updating from vite 5.3.5 to 5.4.7. |
Hmm, does it only happen on Chromium browsers (e.g. Chrome, Edge)? It feels like it's similar to https://www.hacksoft.io/blog/handle-images-cors-error-in-chrome (https://issues.chromium.org/issues/40381978). |
We also have production outage after updating from vite 5.3.3 to 5.4.8. |
We also experience this issue when upgrading to the latest version of Nuxt, which uses Vite 5.4.6. Downgrading to 5.4.2 worked, but now there is a reported security vulnerability. I have tried the workaround from @georgemincof but this causes all of our CSS assets not to load at all. |
Published v5.4.10 that changes all hashes of CSS files. It should be fine to upgrade now that the hashes are different from the older deployed ones. |
Describe the bug
Hi!
We encountered an issue with version 5.4.3 that breaks our app in production:
This change affects users who already have the CSS resources cached. By adding the crossorigin attribute, the browser automatically cancels the requests due to CORS.
For some reason, the failed preload is causing the entire app to break.
For now, I’ve locked the version to 5.4.2 until I find a solution.
Reproduction
Steps to reproduce
No response
System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: