title: Splitting Angular CLI application in two builds
body: <p>I have an angular solution build on Angular 7 using the CLI. The app has 2 areas. They are not connected in any way, but they use the same code base.</p>
  
  <p>Right now I can go to <code>http://localhost:4200/app1</code>, or <code>http://localhost:4200/app2</code>.
  But they are running on the same instance. I would like to modify my configuration so I could write something like</p>
  
  <pre><code>ng build --app=app1
  </code></pre>
  
  <p>and get a standalone solution. Any suggestions to, what I could do ?</p>
  
  <p>Below is my angular.json file. As you can see, I allready have a setup for development, staging, and production. This means that at the moment, I can write</p>
  
  <pre><code>ng build --build-optimizer --configuration=staging
  </code></pre>
  
  <p>and get a build for staging environment.</p>
  
  <pre><code>{
    "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
    "version": 1,
    "newProjectRoot": "projects",
    "projects": {
      "vhTogo": {
        "root": "",
        "sourceRoot": "src",
        "projectType": "application",
        "prefix": "app",
        "schematics": {},
        "architect": {
          "build": {
            "builder": "@angular-devkit/build-angular:browser",
            "options": {
              "outputPath": "dist/vhTogo",
              "index": "src/index.html",
              "main": "src/main.ts",
              "polyfills": "src/polyfills.ts",
              "tsConfig": "src/tsconfig.app.json",
              "assets": [
                "src/assets",
                "src/manifest.json"
              ],
              "styles": [
                "src/styles/styles.scss"
              ],
              "scripts": []
            },
            "configurations": {
              "production": {
                "fileReplacements": [
                  {
                    "replace": "src/environments/environment.ts",
                    "with": "src/environments/environment.prod.ts"
                  }
                ],
                "outputPath": "dist/production",
                "vendorChunk": true,
                "optimization": true,
                "outputHashing": "all",
                "sourceMap": false,
                "extractCss": true,
                "namedChunks": false,
                "aot": true,
                "extractLicenses": true,
                "buildOptimizer": true,
                "serviceWorker": true
              },
              "staging": {
                "fileReplacements": [
                  {
                    "replace": "src/environments/environment.ts",
                    "with": "src/environments/environment.staging.ts"
                  }
                ],
                "outputPath": "dist/staging",
                "vendorChunk": true,
                "optimization": true,
                "outputHashing": "all",
                "sourceMap": false,
                "extractCss": true,
                "namedChunks": false,
                "aot": true,
                "extractLicenses": true,
                "buildOptimizer": true,
                "serviceWorker": true
              },
              "development": {
                "fileReplacements": [
                  {
                    "replace": "src/environments/environment.ts",
                    "with": "src/environments/environment.development.ts"
                  }
                ],
                "outputPath": "dist/development",
                "vendorChunk": true,
                "optimization": true,
                "outputHashing": "all",
                "sourceMap": false,
                "extractCss": true,
                "namedChunks": false,
                "aot": true,
                "extractLicenses": true,
                "buildOptimizer": true,
                "serviceWorker": true
              }
            }
          },
          "serve": {
            "builder": "@angular-devkit/build-angular:dev-server",
            "options": {
              "browserTarget": "vhTogo:build"
            },
            "configurations": {
              "production": {
                "browserTarget": "vhTogo:build:production"
              }
            }
          },
          "extract-i18n": {
            "builder": "@angular-devkit/build-angular:extract-i18n",
            "options": {
              "browserTarget": "vhTogo:build"
            }
          },
          "test": {
            "builder": "@angular-devkit/build-angular:karma",
            "options": {
              "main": "src/test.ts",
              "polyfills": "src/polyfills.ts", 
              "tsConfig": "src/tsconfig.spec.json",
              "karmaConfig": "src/karma.conf.js",
              "styles": [
                "src/styles/styles.scss"
              ],
              "scripts": [],
              "assets": [
                "src/assets",
                "src/manifest.json"
              ]
            }
          },
          "lint": {
            "builder": "@angular-devkit/build-angular:tslint",
            "options": {
              "tsConfig": [
                "src/tsconfig.app.json",
                "src/tsconfig.spec.json"
              ],
              "exclude": [
                "**/node_modules/**"
              ]
            }
          }
        }
      },
      "vhTogo-e2e": {
        "root": "e2e/",
        "projectType": "application",
        "architect": {
          "e2e": {
            "builder": "@angular-devkit/build-angular:protractor",
            "options": {
              "protractorConfig": "e2e/protractor.conf.js",
              "devServerTarget": "vhTogo:serve"
            },
            "configurations": {
              "production": {
                "devServerTarget": "vhTogo:serve:production"
              }
            }
          },
          "lint": {
            "builder": "@angular-devkit/build-angular:tslint",
            "options": {
              "tsConfig": "e2e/tsconfig.e2e.json",
              "exclude": [
                "**/node_modules/**"
              ]
            }
          }
        }
      }
    },
    "defaultProject": "vhTogo",
    "schematics": {
      "@schematics/angular:component": {
        "styleext": "scss"
      }
    }
  }
  </code></pre>