Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
92 views
in Technique[技术] by (71.8m points)

Issue when trying to run Ionic Core on Cordova with JavaScript on IOS Simulator

I have decided to use Ionic Core due to the fact of me not needing to use Frameworks like Vue, Angular and React.

I have created a project using Cordova and installed @ionic/core with npm to create the files that would otherwise use a CDN.

However, I have included them into my index.html application with an h1 tag saying Hello World, this does not appear on the IOS Simulator using XCode. I do not get any error messages, it just shows a blank white screen.

This leads me to believe that this could be due to me not initialising the Ionic Core javascript file.

Here is my index.html file:

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script type="module" src="core/dist/ionic/ionic.esm.js"></script>
    <script nomodule src="core/dist/ionic/ionic.js"></script>
    <link href="core/css/ionic.bundle.css" rel="stylesheet">
</head>

<body>
    <h1>Hello World</h1>
</body>

</html>

Here is my project directory shown using VSCode:

Project Directory

No errors are shown on XCode nor on the Cordova side of things when launching it with cordova run ios

I cannot launch with Ionic as I am only using the Javascript files not the actual CLI

question from:https://stackoverflow.com/questions/65950750/issue-when-trying-to-run-ionic-core-on-cordova-with-javascript-on-ios-simulator

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Try using Ionic Core is by adding a script tag to the CDN:

<script type="module" src="https://cdn.jsdelivr.net/npm/@ionic/core/dist/ionic/ionic.esm.js"></script>
<script nomodule src="https://cdn.jsdelivr.net/npm/@ionic/core/dist/ionic/ionic.js"></script>
<link href="https://cdn.jsdelivr.net/npm/@ionic/core/css/ionic.bundle.css" rel="stylesheet">

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...