国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 語(yǔ)言 > JavaScript > 正文

使用angular-cli webpack創(chuàng)建多個(gè)包的方法

2024-05-06 15:28:41
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

當(dāng)我使用angular-cli構(gòu)建項(xiàng)目時(shí),它會(huì)將所有項(xiàng)目文件捆綁到一個(gè)主要的主包中.

我在應(yīng)用程序中使用了懶惰路由,一旦應(yīng)用程序加載,我就可以導(dǎo)航.

有沒(méi)有一種方法可以將主包分為多個(gè)基于懶惰加載的路由模塊的文件?

下面是角度-cli.json中的配置

{ "project": {  "version": "1.0.0-beta.15",  "name": "maddy-test-project" }, "apps": [  {   "root": "src",   "outDir": "dist",   "assets": "styles/content",   "index": "default.htm",   "main": "main.ts",   "test": "test.ts",   "tsconfig": "tsconfig.json",   "prefix": "",   "mobile": false,   "styles": [    "styles.less"   ],   "scripts": [    "styles/wfa-myriad-pro-typekit.js"   ],   "environments": {    "source": "environments/environment.ts",    "dev": "environments/environment.ts",    "prod": "environments/environment.prod.ts"   }  } ], "addons": [], "packages": [], "e2e": {  "protractor": {   "config": "./protractor.conf.js"  } }, "test": {  "karma": {   "config": "./karma.conf.js"  } }, "defaults": {  "styleExt": "less",  "prefixInterfaces": false }}

下面是package.json

{ "name": "maddy-test-project", "version": "0.0.1", "license": "MIT", "angular-cli": {}, "scripts": {  "start": "ng serve",  "lint": "tslint /"src/**/*.ts/"",  "test": "ng test",  "pree2e": "webdriver-manager update",  "e2e": "protractor" }, "private": true, "dependencies": {  "@angular/common": "2.0.0",  "@angular/compiler": "2.0.0",  "@angular/core": "2.0.0",  "@angular/forms": "2.0.0",  "@angular/http": "2.0.0",  "@angular/platform-browser": "2.0.0",  "@angular/platform-browser-dynamic": "2.0.0",  "@angular/router": "3.0.0",  "d3": "^4.2.3",  "jquery": "^3.1.0",  "lodash": "^4.15.0",  "moment": "^2.15.0",  "core-js": "^2.4.1",  "rxjs": "5.0.0-beta.12",  "toastr": "^2.1.2",  "ts-helpers": "^1.1.1",  "zone.js": "^0.6.23",   "bootstrap-daterangepicker": "^2.1.24" }, "devDependencies": {  "@types/d3": "^3.5.35",  "@types/google-maps": "^3.1.27",  "@types/jasmine": "^2.2.30",  "@types/jquery": "^1.10.31",  "@types/lodash": "^4.14.34",  "@types/toastr": "^2.1.29",  "angular-cli": "1.0.0-beta.15",  "codelyzer": "~0.0.26",  "jasmine-core": "2.4.1",  "jasmine-spec-reporter": "2.5.0",  "karma": "1.2.0",  "karma-chrome-launcher": "^2.0.0",  "karma-cli": "^1.0.1",  "karma-jasmine": "^1.0.2",  "karma-remap-istanbul": "^0.2.1",  "protractor": "4.0.5",  "ts-node": "1.2.1",  "tslint": "3.13.0",  "typescript": "2.0.2" }}

提前致謝!!

它是NgModule和RouterModule.forChild()的作用.這是一個(gè)非常好的文章,用于啟動(dòng)大型角度2模塊化應(yīng)用開(kāi)發(fā): http://blog.angular-university.io/angular2-ngmodule/

The first thing that we need to do is to remove every mention of the Home component or the HomeModule from the App component and the main routing configuration:
We can see here that the App component no longer imports HomeModule, instead the routing config uses loadChildren to say that if /home or any other url starting with it gets hit, then the file home.module should be loaded via an Ajax call.

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表

圖片精選

主站蜘蛛池模板: 江华| 安西县| 红桥区| 鄄城县| 衡东县| 郧西县| 恩施市| 内黄县| 锦屏县| 广汉市| 东山县| 加查县| 准格尔旗| 宁德市| 祥云县| 凤庆县| 文山县| 顺昌县| 纳雍县| 龙泉市| 安阳市| 白银市| 阿图什市| 苏州市| 册亨县| 通辽市| 云浮市| 吉木乃县| 保德县| 青冈县| 漠河县| 大安市| 公主岭市| 信丰县| 永胜县| 阿鲁科尔沁旗| 奉节县| 墨江| 齐河县| 姚安县| 昭平县|