Ionic 4运行浏览器无法加载资源

问题描述 投票:0回答:1

我用ionic start test sidemenu --type=angular创建了一个简单的Ionic 4侧菜单应用程序,称为“测试”。

然后,不做任何更改,我运行ionic cordova run browser,并自动打开浏览器,一切正常,很好。

问题是,如果我尝试直接在浏览器中打开/platforms/browser/www/index.html文件,则出现黑页,并且文件出现failed to load resources错误:runtime.js, polyfills.js, styles.js, cordova.js, vendor.js, vendor.js

如果运行ionic cordova run browser --prod,则行为相同。

使用ionic 3,我没有错误。

无法加载资源:

enter image description here

我的离子信息是:

Ionic:

   ionic (Ionic CLI)             : 4.2.1 (/usr/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.0.0-beta.13
   @angular-devkit/build-angular : 0.8.6
   @angular-devkit/schematics    : 0.8.6
   @angular/cli                  : 6.2.6
   @ionic/angular-toolkit        : 1.0.0

Cordova:

   cordova (Cordova CLI) : 8.0.0
   Cordova Platforms     : browser 5.0.4
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.2.0, (and 4 other plugins)

System:

   Android SDK Tools : 26.1.1 (/home/losciur/Android/Sdk)
   NodeJS            : v8.12.0 (/usr/bin/node)
   npm               : 6.4.1
   OS                : Linux 4.8
ionic-framework browser resources ionic4
1个回答
2
投票

添加 <base href="." />index.html删除 <base href="/" />中。

© www.soinside.com 2019 - 2024. All rights reserved.