javascript - Ionic 3 - 应用程序在使用 --prod 构建后显示空白屏幕

标签 javascript angular typescript ionic2 ionic3

它只发生在 --prod 和手机 (Android) 上。一件奇怪的事情是,如果我触摸任何地方(即使它全是白色),应该在该特定位置触发的事件会被触发,然后突然显示内容。

我阅读了一些有关 TypeScript 版本与 @ionic/app-scripts 冲突的内容,以及我如何需要降级到 TypeScript 2.0.x,但如果我这样做,我会在构建时遇到错误那喊着:

Cannot read property 'Private' of undefined: tsickle.js:118:40

我想这与我的依赖项的所有其他版本与该版本的 TS 冲突有关。

这是我的 package.json:

 {
  "name": "green-dragon",
  "version": "0.0.1",
  "author": "Test",
  "homepage": "http://www.huskysoftware.com.ar/",
  "private": true,
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "lint": "ionic-app-scripts lint",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  },
  "dependencies": {
    "@angular/common": "4.4.3",
    "@angular/compiler": "4.4.3",
    "@angular/compiler-cli": "4.4.3",
    "@angular/core": "4.4.3",
    "@angular/forms": "4.4.3",
    "@angular/http": "4.4.3",
    "@angular/platform-browser": "4.4.3",
    "@angular/platform-browser-dynamic": "4.4.3",
    "@ionic-native/core": "4.3.0",
    "@ionic-native/geolocation": "^4.4.2",
    "@ionic-native/network": "^4.3.1",
    "@ionic-native/splash-screen": "4.3.0",
    "@ionic-native/status-bar": "4.3.0",
    "cordova-android": "6.3.0",
    "cordova-ios": "^4.5.1",
    "cordova-plugin-compat": "^1.2.0",
    "cordova-plugin-device": "^1.1.4",
    "cordova-plugin-geolocation": "^3.0.0",
    "cordova-plugin-ionic-webview": "^1.1.15",
    "cordova-plugin-network-information": "^1.3.3",
    "cordova-plugin-splashscreen": "^4.0.3",
    "cordova-plugin-statusbar": "git+https://github.com/apache/cordova-plugin-statusbar.git",
    "cordova-plugin-whitelist": "^1.3.1",
    "ionic-angular": "3.7.1",
    "ionic-native": "^2.9.0",
    "ionic-plugin-keyboard": "^2.2.1",
    "ionicons": "3.0.0",
    "lodash": "^4.17.4",
    "moment": "^2.19.1",
    "rxjs": "5.4.3",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.18"
  },
  "devDependencies": {
    "@ionic/app-scripts": "3.1.4",
    "typescript": "2.0.9"
  },
  "description": "A beer map app",
  "cordova": {
    "plugins": {
      "cordova-plugin-device": {},
      "cordova-plugin-ionic-webview": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-statusbar": {},
      "ionic-plugin-keyboard": {},
      "cordova-plugin-network-information": {},
      "cordova-plugin-whitelist": {},
      "cordova-plugin-geolocation": {
        "GEOLOCATION_USAGE_DESCRIPTION": "Encontrar bares cercanos"
      }
    },
    "platforms": [
      "ios",
      "android"
    ]
  }
}

显然,--minifyjs 标志是这里的标志。但还是不知道为什么

最佳答案

我想在这里给出 2 个线索。

  1. --prod 使用 AOT。因此,您不能在 *.html 文件上使用 private 属性。所以你需要找出你在哪里使用过它。希望这个错误可以帮助您找出它。 无法读取未定义的“私有(private)”属性:tsickle.js:118:40

  2. 我强烈建议您将您的应用程序升级到最新版本 Ionic 3.9.2

关于javascript - Ionic 3 - 应用程序在使用 --prod 构建后显示空白屏幕,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47663264/

相关文章:

typescript - 将 Testcafe 与 Appium 结合使用

javascript - React Component 成员在渲染后重置为未定义

typescript - "can only be default-imported using the ' esModuleInterop'标志”是什么意思?

javascript - Javascript中的回调机制

android - Ionic 2/3 - 扫描设备时忽略其他应用程序/android 目录的简单方法

javascript - Ionic - 删除数组中的项目时出现问题

html - Csv 阅读器 typescript

javascript - VideoSphere 不在 A 帧中播放视频,即使遵循了其他指导也是如此

javascript - 如何使用scheduler.js在fullcalendar中添加事件?

javascript - 了解 modal.js 中的事件