Josh
Josh

Reputation: 504

Cannot load module with Cordova and Ionic on Android

I am importing Ionic into my index.html with this:

<script type="module" src="ionic/ionic/ionic.esm.js"></script>
<script nomodule="" src="ionic/ionic/ionic.js"></script>

On Browser and iOS and even Android Emulator everything works fine. Only on Android Devices I get Failed to load module script: The server responded with a non-JavaScript MIME type of "".

I found one or two questions on SO and issues on GitHub, but no simple solution to my problem..

How can I resolve the error?

Upvotes: 1

Views: 696

Answers (1)

jcesarmobile
jcesarmobile

Reputation: 53351

If you are loading from file protocol (default by cordova) you can’t use modules.

You can use cordova-plugin-ionic-webview, it loads from http or https and modules will work.

Upvotes: 3

Related Questions