Failed to load module script: The server responded with a non-JavaScript MIME type of "text/jsx". Strict MIME type checking is enforced for module scripts per HTML spec. code example

Example 1: Failed to load module script: The server responded with a non-JavaScript MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.

// Express - you have to set static folder
// Make a folder called public
const express = require('express');
const app = express();
const path = require('path');
app.use(express.static(path.join(__dirname, 'public')));

Example 2: Failed to load module script: The server responded with a non-JavaScript MIME type of "application/json". Strict MIME type checking is enforced for module scripts per HTML spec.

A simple workaround:

config.js

export default
{
  // my json here...
}
then...

import config from '../config.js'
does not allow import of existing .json files, but does a job.