如何使用angular-cli编译多个Angular 2模块?

时间:2016-10-07 20:33:35

标签: angular angular-cli

目前有没有办法使用Angular CLI编译多个应用程序节点?

当尝试运行“ng build -w”时,它会在“angular-cli.json”文件的“apps”节点中找到第一个“app”。

"apps": [
{
  "root": "src",
  "outDir": "dist/backoffice",
  "assets": "assets",
  "index": "index.html",
  "main": "main.ts",
  "test": "test.ts",
  "tsconfig": "tsconfig.json",
  "prefix": "app",
  "mobile": false,
  "styles": [
    "styles.css"
  ],
  "scripts": [],
  "environments": {
    "source": "environments/environment.ts",
    "dev": "environments/environment.ts",
    "prod": "environments/environment.prod.ts"
  }
},
{
  "root": "someOtherApp",
  "outDir": "dist/someOtherApp",
  "assets": "assets",
  "index": "index.html",
  "main": "someOtherApp.ts",
  "test": "someOtherApp.ts",
  "tsconfig": "tsconfig.json",
  "prefix": "app",
  "mobile": false,
  "styles": [
    "styles.css"
  ],
  "scripts": [],
  "environments": {
    "source": "environments/environment.ts",
    "dev": "environments/environment.ts",
    "prod": "environments/environment.prod.ts"
  }
}

第二个应用程序“someOtherApp”不应该在之后开始编译吗?

1 个答案:

答案 0 :(得分:0)

使用文档中所述的ng build --app=<id>ng build --app=<name>https://github.com/angular/angular-cli/blob/master/docs/documentation/stories/multiple-apps.md