ES6 modules in local files – The server responded with a non-JavaScript MIME type

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';

Leave a Comment