0

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.

I get this error after each npm run build and firebase deploy. But when i clear the browser chache, the page loads normally, until the app gets rebuild app again.

This is my firebase.json

{
  "hosting": {
    "public": "dist",
    "ignore": [],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  }
}
  • I tried deleting dist directory and rebuilding
  • I followed instructions in the vite documentation:

ViteFirebaseDocs

The fact that clearing the browser cache fixes the problem, at least temporarily, is a strong indicator that caching might be part of the issue, but vite should handle cashbusting itself right ?

ToniLu
  • 11
  • 4
  • Does this answer your question? [how to force vite clearing cache in vue3](https://stackoverflow.com/questions/68046410/how-to-force-vite-clearing-cache-in-vue3) – yoduh Jul 27 '23 at 19:00
  • Unfortunately not. The hashes are changed without workarounds... – ToniLu Jul 28 '23 at 10:40

0 Answers0