我们使用 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/