FAILED TO LOAD MODULE SCRIPT after deploy on Netlify. In localhost works well

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

command = “npm run build”
publish = “/dist”

node_bundler = “esbuild”

VITE_DOMAIN = “api_url_domain”

from = “/*”
to = “/index.html”
status = 200

Hey @pierpaolosestito-dev

Are you able to share the URL for the site, and the repository you are building?