ionic-team / ionic-framework

A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.
https://ionicframework.com
MIT License
50.93k stars 13.52k forks source link

bug: ios --prod generating blank page #18923

Closed marcelgoya closed 5 years ago

marcelgoya commented 5 years ago

Bug Report

Ionic version:

[x] **4.7.1

Current behavior:

Compiling and running the app on iOS in debug mode works fine but it produces a blank page with the error message below when compiled with --prod. I've followed the upgrade steps from the Angular guide. Unfortunately, the message does not give any indication about where the problem is coming from.

Expected behavior:

Steps to reproduce:

Related code:

Could not find cordova.js script tag. Plugin loading may fail.
[Error] ERROR
Error: Uncaught (in promise): TypeError: undefined is not an object (evaluating 'U') m2y1@ionic://localhost/28.e560569324561c090fec.js:1:61776 r@ionic://localhost/runtime.83dd134c593999656e86.js:1:511 ionic://localhost/main.e445cde49b420b605023.js:1:1837515 onInvoke@ionic://localhost/main.e445cde49b420b605023.js:1:666706 run@ionic://localhost/polyfills.1443a8ca1477b45c1ab9.js:1:2314 ionic://localhost/polyfills.1443a8ca1477b45c1ab9.js:1:14287 onInvokeTask@ionic://localhost/main.e445cde49b420b605023.js:1:666622 runTask@ionic://localhost/polyfills.1443a8ca1477b45c1ab9.js:1:2981 g@ionic://localhost/polyfills.1443a8ca1477b45c1ab9.js:1:10063 promiseReactionJob@[native code]
j — polyfills.1443a8ca1477b45c1ab9.js:1:13543
j — polyfills.1443a8ca1477b45c1ab9.js:1:13093
(anonymous function) — polyfills.1443a8ca1477b45c1ab9.js:1:14323
onInvokeTask — main.e445cde49b420b605023.js:1:666623
runTask — polyfills.1443a8ca1477b45c1ab9.js:1:2982
g — polyfills.1443a8ca1477b45c1ab9.js:1:10064
promiseReactionJob
    ba (main.e445cde49b420b605023.js:1:528974)
    handleError (main.e445cde49b420b605023.js:1:529188)
    handleError (main.e445cde49b420b605023.js:1:2481240)
    next (main.e445cde49b420b605023.js:1:673849)
    (anonymous function) (main.e445cde49b420b605023.js:1:646137)
    __tryOrUnsub (main.e445cde49b420b605023.js:1:769799)
    next (main.e445cde49b420b605023.js:1:768952)
    _next (main.e445cde49b420b605023.js:1:768012)
    next (main.e445cde49b420b605023.js:1:767684)
    next (main.e445cde49b420b605023.js:1:835578)
    emit (main.e445cde49b420b605023.js:1:645918)
    run (polyfills.1443a8ca1477b45c1ab9.js:1:2315)
    onHandleError (main.e445cde49b420b605023.js:1:666990)
    runGuarded (polyfills.1443a8ca1477b45c1ab9.js:1:2533)
    e (polyfills.1443a8ca1477b45c1ab9.js:1:12172)
    microtaskDrainDone (polyfills.1443a8ca1477b45c1ab9.js:1:12221)
    g (polyfills.1443a8ca1477b45c1ab9.js:1:10131)
    promiseReactionJob

My package.json output:

{
  "name": "app",
  "version": "1.0.1",
  "license": "Apache-2.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test --watch=false",
    "lint": "ng lint"
  },
  "husky": {
    "hooks": {
      "pre-commit": "npm run lint",
      "pre-push": "npm run test"
    }
  },
  "private": true,
  "dependencies": {
    "@angular/common": "8.1.1",
    "@angular/core": "8.1.1",
    "@angular/forms": "8.1.1",
    "@angular/platform-browser": "8.1.1",
    "@angular/platform-browser-dynamic": "8.1.1",
    "@angular/pwa": "~0.801.1",
    "@angular/router": "8.1.1",
    "@angular/service-worker": "~8.1.1",
    "@feathersjs/client": "^3.7.8",
    "@ionic-native/background-mode": "5.10.0",
    "@ionic-native/barcode-scanner": "5.10.0",
    "@ionic-native/call-number": "5.10.0",
    "@ionic-native/camera": "5.10.0",
    "@ionic-native/core": "5.10.0",
    "@ionic-native/device": "5.10.0",
    "@ionic-native/file": "5.10.0",
    "@ionic-native/file-transfer": "5.10.0",
    "@ionic-native/geolocation": "5.10.0",
    "@ionic-native/google-maps": "^5.5.0",
    "@ionic-native/in-app-browser": "5.10.0",
    "@ionic-native/keyboard": "5.10.0",
    "@ionic-native/media": "5.10.0",
    "@ionic-native/media-capture": "5.10.0",
    "@ionic-native/native-audio": "5.10.0",
    "@ionic-native/native-storage": "5.10.0",
    "@ionic-native/network": "5.10.0",
    "@ionic-native/safari-view-controller": "5.10.0",
    "@ionic-native/social-sharing": "5.10.0",
    "@ionic-native/speech-recognition": "5.10.0",
    "@ionic-native/splash-screen": "5.10.0",
    "@ionic-native/status-bar": "5.10.0",
    "@ionic/angular": "^4.7.1",
    "@ionic/storage": "^2.2.0",
    "@ngrx/core": "^1.2.0",
    "@ngrx/effects": "^8.1.0",
    "@ngrx/entity": "^8.1.0",
    "@ngrx/store": "^8.1.0",
    "@ngrx/store-devtools": "^8.1.0",
    "@ngx-translate/core": "^11.0.1",
    "@ngx-translate/http-loader": "^4.0.0",
    "cordova-android": "^8.0.0",
    "cordova-ios": "^5.0.1",
    "core-js": "^2.5.7",
    "es6-promise-plugin": "^4.2.2",
    "fine-uploader": "^5.16.2",
    "fs.extra": "^1.3.2",
    "google-libphonenumber": "^3.2.2",
    "gsap": "^2.1.2",
    "hammerjs": "^2.0.8",
    "immutable": "^3.8.2",
    "klaw": "^2.1.1",
    "lockr": "^0.8.5",
    "lodash": "^4.17.15",
    "minimist": "^1.2.0",
    "moment": "^2.24.0",
    "moment-timezone": "^0.5.23",
    "ngrx-6-store-ionic-storage": "1.0.1",
    "ngx-color-picker": "^8.1.0",
    "ngx-moment": "^3.4.0",
    "ngx-popper": "^6.0.7",
    "popper.js": "^1.15.0",
    "raven-js": "^3.27.0",
    "rxjs": "6.5.2",
    "safe-buffer": "^5.2.0",
    "shortid": "^2.2.14",
    "socket.io-client": "^2.2.0",
    "svg.js": "^2.7.1",
    "sw-toolbox": "3.6.0",
    "tslib": "^1.9.0",
    "util-promisify": "^2.1.0",
    "webpack-obfuscator": "^0.18.0",
    "xml2js": "^0.4.19",
    "zone.js": "^0.9.1"    
  },
  "devDependencies": {
    "@angular-devkit/architect": "^0.801.1",
    "@angular-devkit/build-angular": "^0.801.2",
    "@angular-devkit/core": "^8.1.1",
    "@angular-devkit/schematics": "^8.1.1",
    "@angular/cli": "^8.1.1",
    "@angular/compiler": "8.1.1",
    "@angular/compiler-cli": "8.1.1",
    "@angular/language-service": "~8.1.1",
    "@ionic/angular-toolkit": "^2.0.0",
    "@ionic/lab": "^2.0.2",
    "@types/jasmine": "3.3.15",
    "@types/jasminewd2": "2.0.6",
    "@types/moment-timezone": "^0.5.12",
    "@types/node": "12.6.8",
    "codelyzer": "^5.1.0",
    "husky": "2.2.0",
    "jasmine-core": "3.4.0",
    "jasmine-spec-reporter": "4.2.1",
    "karma": "4.1.0",
    "karma-chrome-launcher": "2.2.0",
    "karma-coverage-istanbul-reporter": "2.0.5",
    "karma-jasmine": "2.0.1",
    "karma-jasmine-html-reporter": "1.4.2",
    "protractor": "5.4.2",
    "puppeteer": "1.17.0",
    "ts-node": "8.2.0",
    "tslint": "^5.17.0",
    "typescript": "~3.4.5"
  },
  "cordova": {
    "platforms": [
      "android",
      "ios"
    ],
    "plugins": {
      "cordova-plugin-ionic-keyboard": {},
      "cordova-plugin-file-transfer": {},
      "cordova-plugin-whitelist": {},
      "cordova-plugin-contacts": {},
      "cordova-plugin-device": {},
      "cordova-plugin-file": {},
      "cordova-plugin-camera": {},
      "cordova-plugin-inappbrowser": {},
      "cordova-plugin-media": {
        "KEEP_AVAUDIOSESSION_ALWAYS_ACTIVE": "NO"
      },
      "cordova-plugin-geolocation": {},
      "cordova-plugin-media-capture": {},
      "cordova-plugin-network-information": {},
      "cordova-plugin-screen-orientation": {},
      "cordova-plugin-nativestorage": {},
      "cordova-plugin-audio-recorder-api": {
        "MICROPHONE_USAGE_DESCRIPTION": " "
      },
      "cordova-plugin-safariviewcontroller": {},
      "io.gvox.plugin.phonecalltrap": {},
      "cordova-plugin-headsetdetection": {},
      "cordova-plugin-x-socialsharing": {
        "ANDROID_SUPPORT_V4_VERSION": "24.1.1+"
      },
      "cordova-plugin-velda-devicefeedback": {},
      "cordova-plugin-screensize": {},
      "cordova-plugin-clipboard-x": {},
      "cordova-plugin-nativegeocoder": {
        "LOCATION_WHEN_IN_USE_DESCRIPTION": "Use geocoder service"
      },
      "cordova-plugin-nativeaudio": {},
      "de.codevise.cordova.volume": {},
      "org.awokenwell.proximity": {},
      "cordova-plugin-android-permissions": {},
      "phonegap-plugin-barcodescanner": {
        "ANDROID_SUPPORT_V4_VERSION": "27.+"
      },
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-video-editor": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-speechrecognition": {},
      "cordova-plugin-tts": {},
      "cordova-plugin-sip": {},
      "onesignal-cordova-plugin": {},
      "cordova-plugin-googlemaps": {
        "PLAY_SERVICES_VERSION": "15.0.1",
        "ANDROID_SUPPORT_V4_VERSION": "27.+",
      },
      "cordova-plugin-permissionScope": {},
      "cordova-plugin-iosrtc": {},
      "com.paypal.cordova.mobilesdk": {},
      "cordova-plugin-ionic-webview": {
        "ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
      },
      "call-number": {},
      "cordova-sms-plugin": {},
      "cordova-plugin-stripe": {},
      "cordova-plugin-background-mode": {}
    }
  }
}

Other information:

Ionic info:


Ionic:

   Ionic CLI                     : 5.2.3 (/usr/local/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.7.1
   @angular-devkit/build-angular : 0.801.2
   @angular-devkit/schematics    : 8.1.2
   @angular/cli                  : 8.1.2
   @ionic/angular-toolkit        : 2.0.0

Cordova:

   Cordova CLI       : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms : android 8.0.0, ios 5.0.1
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.1.1, (and 38 other plugins)

Utility:

   cordova-res : 0.6.0
   native-run  : 0.2.8

System:

   Android SDK Tools : 26.1.1 (/Users/marcel/Library/Android/sdk/)
   ios-deploy        : 1.9.4
   ios-sim           : 8.0.1
   NodeJS            : v10.15.1 (/usr/local/bin/node)
   npm               : 6.10.2
   OS                : macOS Mojave
   Xcode             : Xcode 10.3 Build version 10G8
marcelgoya commented 5 years ago

I've managed to find the error myself. It was a problem with the gsap library being imported the "wrong" way. The solution is to change the import from

import { TweenMax, Bounce } from 'gsap';

to

import { TweenMax, Bounce } from 'gsap/all';

I figured it out when I deployed the web version to our dev server and it produced another error message.

ionitron-bot[bot] commented 5 years ago

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.