Skip to content Skip to sidebar Skip to footer

Es6 Import Using.mjs Suffix Fails With Mime Error

In the latest chrome browser import foo from '../dist/foo.mjs' fails with Failed to load module script: The server responded with a non-JavaScript MIME type of ''. Strict MIME ty

Solution 1:

You need to usa an .htaccess file or extend your Apache config file with the following htaccess directive in order for the server to output files with the mjs extension with the correct MIME type:

<IfModulemod_mime.c>
  AddType text/javascript js mjs
</IfModule>

Of course, mod_mime needs to be installed and enabled for this to work.

Post a Comment for "Es6 Import Using.mjs Suffix Fails With Mime Error"