I get this error:
Failed to load module script: The server responded with a non-JavaScript MIME type of "". Strict MIME type checking is enforced for module scripts per HTML spec.
The project is run from local files, eg.: file:///D:/path/project.html
.
Works without problems in Firefox, but doesn't work in Google Chrome. I want to test it this way for development purposes - it's more comfortable than creating a server and remembering what port is it on.
As ES6 refers to a huge specification and browsers have various levels of support, "Supported" means at least 95% of the spec is supported.
Modules are the piece or chunk of a JavaScript code written in a file. JavaScript modules help us to modularize the code simply by partitioning the entire code into modules that can be imported from anywhere. Modules make it easy to maintain the code, debug the code, and reuse the piece of code.
A simple fix for me that wasn't listed here was this:
I had an import statement bringing an object from a different file, which I did via this line:
import { Cell } from './modules/Cell';
What broke the code and caused the MIME type error was not having .js
appended to the end of ./modules/Cell
.
The updated line fixed my problem:
import { Cell } from './modules/Cell.js';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With