Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Server responds with a non-JavaScript MIME type of ""

I want to wrap an angular application with cordova. After hitting "cordova run android" and inspecting it in Chrome, the console states:

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

On my phone I obviously only get a white screen then. How can I solve this issue?

When i hit "cordova serve" and look at it in the browser on my PC, there are no errors thrown and everything works fine.

Thank you in advance.

MIME type of ""

like image 974
Darius Avatar asked Oct 19 '25 03:10

Darius


1 Answers

I could figure it out, even if it is not a great solution I guess and there might be something nicer.

After running ng build --prod --aot I went into my index.html and put type="text/javascript" into the <script> tags.

So basically from

<script src="runtime-es2015.858f8dd898b75fe86926.js" type="module">

to

<script type="text/javascript" src="runtime-es2015.858f8dd898b75fe86926.js" type="module">

After that I got no more errors.

like image 69
Darius Avatar answered Oct 21 '25 16:10

Darius



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!