JS module/imports errors

Greetings to All,

Can someone help me with this error on how to solve it? I want to add imports and I add attribute type=" module" in my script and throw the error below.

how to solve was blocked because of a disallowed MIME type (“text/html”)

Thanks in Advance,

please add all the details you can about the error you have met.

what have you tried to solve it? what do you think is going on?

  • Have you qualified the imports, ie are you using the correct syntax for JS imports (import {foo} from "./foo.js", note the file extension is required).
  • Are you running this on a local server (I assume you are, as I’d expect a CORs error if you weren’t, but need to check

As @ilenia says, need more details

This is the actual error:

Uncaught SyntaxError: import declarations may only appear at top level of a module

I search about it, the most solution they say is adding type=“module” attribute on the js path…

But when i put it, the below error exists:

Loading module from “” was blocked because of a disallowed MIME type (“text/html”).

Check the photo below

you aren’t qualifying the import. When you use import it needs the file extension. That’s how imports work in JavaScript.

Also just for future reference can you post code when you have a problem, it’s extremely difficult to provide help based on a picture or a gif

1 Like

Thanks, Dan… ok i will post code next time…