-
Notifications
You must be signed in to change notification settings - Fork 32
Description
Bug:
platform ready() is called 'before' cordova deviceready when doing a livereload build. And it is called with readySource = "dom" instead of "cordova".
Reason:
ionic:platform code to setup ready() promise runs before cordova.js has loaded. So it decides that it is not in cordova environment and doesn't need to wait for deviceready.
Why this seems to be happening:
(Probably not due to this, see my comment below)
When doing ionic cordova run ios --livereload
, cordova.js is added in script tags at the end. This could be the reason why vendor.js/main.js code doesn't find window.cordova object when settings up platform.ready promise.
Same behavior as above when trying to run using:
ionic serve --no-open --external --consolelogs --engine=cordova --platform=ios
When doing ionic cordova prepare ios
, cordova.js is added in script tags before vendor.js or main.js. So things work OK here.
Possible Fix
Change order in which code adds cordova.js script tag for livereload/serve builds. It should be before code adds script tags vendor.js or main.js.
Ionic Info
Ionic:
Ionic CLI : 6.12.1 (/Users/user/.npm-global/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 4.11.13
@angular-devkit/build-angular : 0.801.3
@angular-devkit/schematics : 8.1.3
@angular/cli : 8.1.3
@ionic/angular-toolkit : 2.3.0 // Pinned to this slightly older version because https://github.com/ionic-team/angular-toolkit/issues/435
Cordova:
Cordova CLI : 10.0.0
Cordova Platforms : android 9.0.0, ios 6.1.1
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, (and 30 other plugins)
Utility:
cordova-res (update available: 0.15.2) : 0.15.1
native-run (update available: 1.3.0) : 1.2.2
System:
Android SDK Tools : 26.1.1 (/Users/user/Library/Android/sdk)
ios-deploy : 1.11.3
ios-sim : 8.0.2
NodeJS : v12.19.0 (/usr/local/bin/node)
npm : 6.13.6
OS : macOS Catalina
Xcode : Xcode 11.6 Build version 11E708