angular - Ionic2 最多需要 30 秒才能加载应用程序

标签 angular ionic-framework ionic2

我们使用 ionic2 和 angular2 构建了几乎 13-14 个功能/模块。

使用了 8-10 个第三方 npm 依赖项和 ionic 插件。

Packge.json

 {
      "name": "Yugma",
      "author": "NxtLife Team",
      "homepage": "http://www.nxtlifetechnologies.com/",
      "private": true,
      "scripts": {
        "build": "ionic-app-scripts build",
        "watch": "ionic-app-scripts watch",
        "serve:before": "watch",
        "emulate:before": "build",
        "deploy:before": "build",
        "build:before": "build",
        "run:before": "build",
        "postinstall": "typings install"
      },
      "dependencies": {
        "@angular/common": "2.2.1",
        "@angular/compiler": "2.2.1",
        "@angular/compiler-cli": "2.2.1",
        "@angular/core": "2.2.1",
        "@angular/forms": "2.2.1",
        "@angular/http": "2.2.1",
        "@angular/platform-browser": "2.2.1",
        "@angular/platform-browser-dynamic": "2.2.1",
        "@angular/platform-server": "2.2.1",
        "@ionic-native/camera": "^3.4.4",
        "@ionic-native/core": "^3.1.0",
        "@ionic-native/file": "^3.4.4",
        "@ionic-native/file-chooser": "^3.4.4",
        "@ionic-native/transfer": "^3.4.4",
        "angular2-moment": "^1.0.0-beta.rc.1",
        "intl": "^1.2.5",
        "ionic-angular": "2.2.0",
        "ionic-gallery-modal": "^0.1.1",
        "ionic-native": "^2.2.3",
        "ionic2-calendar": "^0.2.4",
        "ionic2-rating": "0.0.10",
        "ionicons": "3.0.0",
        "nxtlife-ionic2-rating": "^1.0.3",
        "rxjs": "5.0.0-beta.12",
        "sw-toolbox": "3.4.0",
        "typings": "1.3.1",
        "underscore": "^1.8.3",
        "zone.js": "0.6.26"
      },
      "devDependencies": {
        "@ionic/app-scripts": "^1.1.4",
        "typescript": "2.0.6"
      },
      "cordovaPlugins": [
        "cordova-plugin-whitelist",
        "cordova-plugin-statusbar",
        "cordova-plugin-device",
        "cordova-plugin-console",
        "ionic-plugin-keyboard",
        "cordova-plugin-splashscreen"
      ],
      "cordovaPlatforms": [],
      "description": "NxtLifeYugma2: An Ionic project"
    }

ionic 信息

Cordova CLI: 6.5.0
Ionic Framework Version: 2.2.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.3.7
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 4.9
Node Version: v6.10.3
Xcode version: Not installed

用 ionic2 解决这个问题太令人沮丧了。 欢迎大家提出任何建议或建议。

最佳答案

正如@Dhyey 所提到的,除了在构建时使用标志 --prod 缩小文件之外,您可能还想做 Ahead-of-Time compilation使用 Ionic CLI 标志 --aot (应与 v2 ionic build 和 v3 ionic cordova build 命令一起使用)。

正如您所提到的,延迟加载确实仅在 v3 中可用(并且仍被标记为 beta/experimental),但 AOT 和缩小本身应该会减少您的应用程序的大小/启动时间。

关于angular - Ionic2 最多需要 30 秒才能加载应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45013964/

相关文章:

ionic-framework - Ionic2:存储 api url 等静态常量的最佳方法是什么?

android - Ionic 3 - 任务 ':app:transformDexArchiveWithExternalLibsDexMergerForDebug' 执行失败

ionic-framework - 什么是更快的 ionic2 或 nativescript?

events - 退订页面更改事件

angular - 具有 Angular http 请求的异步管道的好处

Angular cli 2 错误无法通过 AOT 构建解析 XXXXX 的所有参数

javascript - 如何以 Angular 获取复选框值?

angularjs - Apple 设备上使用 Ionic 框架的 LinkedIn oauth 2.0 (REST)

angular - npm ERR! 是什么原因?当我创建 Angular 4 应用程序时,在结束后写?

node.js - Angular 上的 post 请求问题