Home ES6 modules on Python http.server
Post
Cancel

ES6 modules on Python http.server

Issue

I cannot use ES6 modules on (Windows) Python http.server. i.e.:

1
<script type="module" src="./index.js"></script>

will raise the error:

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

Useful links

  • https://stackoverflow.com/questions/63166774/how-can-i-use-es6-modules-on-python-http-server

Temporary solusion

Delated type="module", but it will still raise warning.

Solusion…

This post is licensed under CC BY 4.0 by the author.