R
R
Ranell2021-10-27 08:05:34
JavaScript
Ranell, 2021-10-27 08:05:34

How to connect the JS module correctly?

When connecting the module in the console, the error is:

Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.

information.php
<script src="js/editor.js" type="module"></script>

editor.js
import Base64UploadAdapter from '../@ckeditor/ckeditor5-upload/src/adapters/base64uploadadapter.js';

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Aetae, 2021-10-27
@Ranell

Man, if you don't know English, use google translate.
Let me do this for you:

Failed to load module script: A JavaScript module script was expected, but the server responded with a MIME type of "text/html". For module scripts, strict MIME type checking is applied according to the HTML specification.

What's incomprehensible here? Do you know what a MIME type is? So google it, this is important knowledge for any web developer. Although you can guess from the context.
How to fix? Correct the MIME type on the server, of course. How this is done for a specific server is quite obvious on Google, by the phrase "<server name\server language> MIME type".
Well, there is some chance that instead of a script it gives you a 404 page, check before everything else.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question