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

[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

Hey @pierpaolosestito-dev

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

this is my git repo : satheesh1022005/Tenzies (github.com)
in that main branch tenzies directory and this is my nelify url : Tenzies (main–tenziesparty.netlify.app)

Publish directory is not set: Build & deploy | Site configuration | tenziesparty | Netlify. Set it correctly based on your app’s settings.