I’m deploying a web-app on Netlify and I’m searching a solution for a problem that I find after deploy: in localhost, I can load module scripts without any problem. After deploy, my web-app doens’t load module script in the right way.
In code I add script in a page in this way:
In login.js there’s a simple import:
import {consts} from '…/lib/consts.js"
And Chrome’s console this is exception that I receive:
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.
What can I do to fix this problem?
This is my netlify.toml
[build]
command = “npm run build”
publish = “/dist”
[functions]
node_bundler = “esbuild”
[context.production.environment]
VITE_DOMAIN = “api_url_domain”
[[redirects]]
from = “/*”
to = “/index.html”
status = 200