1
votes

So i'm trying to use Ionic 4 on a plain javascript for my cordova project. What i did was installing ionic using npm.

Then i create a cordova project:

cordova create testion

Then add android platform

cordova platform add android

After that i go into the newly created cordova directory and run this:

npm install @ionic/core

then copied all the content of node_modules/@ionic to www and in my index.html i import the ionic like so:

<head>
  <script type='text/javascript' src="core/dist/ionic.js"></script>
  <link rel="stylesheet" href="core/css/ionic.bundle.css">
</head>

Then i run it on my android:

cordova run android

What i got was a blank page with this error on the console:

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. - core/dist/ionic/ionic.esm.js:1

The app works ok if i run it on browser by using:

cordova run browser

Am i doing anything wrong? please help. thank you

UPDATE: I tested this on my Galaxy J5 Pro running Android 7.0

1
put your script link in the bodyuser9088454
@user9088454 tried it. but still got the same errorShRos

1 Answers

0
votes

Running this command npm run build --es5 should fix the error. If not please show the complete HTML code also.

And also I don't understand why you ran the code npm install @ionic/core.

Hope this helps.