title: Exclude modules from ng-build in Angular CLI... not working
body: <p>I have an Angular CLI project with two apps in it. Both apps are the same, but one app includes all files in the build, the other needs to exclude a module. </p>
  
  <p>Angular CLI version: 1.7.4
  Angular version: 5.2.10</p>
  
  <p>I added two apps into the angular-cli.json file, and each has a separate ts-config file. </p>
  
  <pre class="lang-js prettyprint-override"><code>  "apps": [
      {
        "name": "app",   &lt;---- first app
        "root": "src",
        "outDir": "/wwwroot",
        "assets": [
          "assets",
          "favicon.ico"
        ],
        "index": "index.html",
        "main": "main.ts",
        "polyfills": "polyfills.ts",
        "test": "test.ts",
        "tsconfig": "tsconfig.app.json",       &lt;----first TS config
        "testTsconfig": "tsconfig.spec.json",
        "prefix": "app",
        "styles": [
          "styles.scss"
        ],
        "scripts": [],
        "environmentSource": "environments/environment.ts",
        "environments": {
          "dev": "environments/environment.ts",
          "prod": "environments/environment.prod.ts"
        }
      },
      {
        "name": "admin",   &lt;---- second app
        "root": "src",
        "outDir": "/wwwroot",
        "assets": [
          "assets",
          "favicon.ico"
        ],
        "index": "index.html",
        "main": "main.ts",
        "polyfills": "polyfills.ts",
        "test": "test.ts",
        "tsconfig": "tsconfig.admin.json", &lt;----- second ts config
        "testTsconfig": "tsconfig.spec.json",
        "prefix": "app",
        "styles": [
          "styles.scss"
        ],
        "scripts": [],
        "environmentSource": "environments/environment.ts",
        "environments": {
          "dev": "environments/environment.ts",
          "prod": "environments/environment.prod.ts"
        }
      }
    ],
  </code></pre>
  
  <p>The "admin" app will include all files.
  However, the first app in the app array, "app" will exclude the admin module. </p>
  
  <p>The tsconfig.app.json:</p>
  
  <pre class="lang-js prettyprint-override"><code>{
    "extends": "../tsconfig.json",
    "compilerOptions": {
      "outDir": "../out-tsc/app",
      "baseUrl": "./",
      "module": "es2015",
      "types": []
    },
    "exclude": [
      "test.ts",
      "**/*.spec.ts",
      "app/modules/admin/"    &lt;----- note: I want this entire directory excluded from the build. 
    ]
  }
  </code></pre>
  
  <p>I set up two "ng-build" scripts in the package.json file. </p>
  
  <p>package.json build scripts:</p>
  
  <pre class="lang-js prettyprint-override"><code>"scripts": {
      "build-app": "ng build -app app --prod",
      "build-admin": "ng build -app admin  --prod",
    },
  </code></pre>
  
  <p>To test this, I changed some text and styling in the admin module and ran the build locally. I noticed that the admin version of the app (which should build all files) works, but the "app" version of the app did NOT exclude the admin module. </p>
  
  <p>Does anyone see anything missed/overlooked in the above snippets? 
  Has anyone had similar problems and found a solution? </p>
  
  <p>The angular-cli repo closed this issue but did not provide a fix. 
  <a href="https://github.com/angular/angular-cli/issues/6050" rel="noreferrer">see issue here</a></p>