Using CSR mode, got asset error when there is a new build

I have a SolidStart project configured to use Client-side rendering (set ssr:false in vite.config.js) and deployed to Google Cloud. When there is a new deploy, the new bundle is generated with new hash. The browser is using the old bundle, so when I change pages, I got the bundle error as attached. What can I do to solve this?
4 Replies
Alex Lohr
Alex Lohr13mo ago
Have you tried to invalidate the cache?
high1
high113mo ago
This can only happen if the index page is cached itself - vite will always generate new hashes for bundle to avoid cache issues. There should be a way to disable caching just for the page that loads the bundle on the Google Cloud - Netlify uses headers for this. A meta tag should work also <meta http-equiv="Cache-Control" content="no-store" />
anhvu0911
anhvu091113mo ago
Thanks, I tried adding these and it worked
<Meta http-equiv="Cache-control" content="no-cache, no-store, must-revalidate" />
<Meta http-equiv="Pragma" content="no-cache" />
<Meta http-equiv="Cache-control" content="no-cache, no-store, must-revalidate" />
<Meta http-equiv="Pragma" content="no-cache" />
Ref: https://stackoverflow.com/questions/34851243/how-to-make-index-html-not-to-cache-when-the-site-contents-are-changes-in-angula Now, let's see what those values mean.
Stack Overflow
How to make index.html not to cache when the site contents are chan...
Normally for .js and .css file we will append a version during build like xx.js?v=123, and then after website deploy, we can get the new version of js and CSS. But I don't see a place talking about...
high1
high113mo ago
Pragma is old HTTP 1.0 spec I think