I’m working on an Angular project, and I’ve run into an issue when deploying to the production environment.
After deployment, I see this error in the browser console for a while:
Failed to load module script: Expected a JavaScript-or-Wasm 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.
However, when I deploy the same build to the staging environment, everything works fine and I don’t see this error.
Why does this happen only on production, and how can I fix it?
It seems to happen right after deploying to production, then starts working after some time.