For a new production build on a React/Vite app, I'd need to clear a browser cache, otherwise there is an error:
Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.
The browser specifically would be looking for index.6b47bc15.js resulted from a previous build, while index.ddb760e3.js would be the current build.
I have inserted this into the html header but it did not help:
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
Is there a way to clear the cache so the browser does not look for the previous build?
Thanks.
Try this?
content="public, must-revalidate, proxy-revalidate, max-age=0"The answer might actually however be to do with what is serving your webapp. For example with AWS s3/cloudfront you can set cache control as follows:
https://how.wtf/set-cache-control-on-s3-objects-using-the-aws-cli.html