Skip to content

Unable to Bootstrap a Multi-app Appliciation with Shared Resources #8809

@mgmarlow

Description

@mgmarlow

Versions

Angular CLI: 1.6.0
Node: 8.4.0
OS: win32 x64
Angular: 5.1.0
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.6.0
@angular-devkit/build-optimizer: 0.0.35
@angular-devkit/core: 0.0.22
@angular-devkit/schematics: 0.0.41
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.0
@schematics/angular: 0.1.10
@schematics/schematics: 0.0.10
typescript: 2.4.2
webpack: 3.10.0

Repro steps

  • Create new main2.ts entry point, place in directory outside of ./my-app/src/ (e.g. ./my-app/src2/)
  • Add a new app entry to .angular-cli.json that points to this new entry point as main at the new root directory. Note: the dependencies of tsconfig.app.json, polyfills.ts, and others are shared between the two apps.
  • ng serve --app 1: Observe error.

Here's a project that reproduces the issue.

npm i
ng serve --app 1

A closer look at the .angular-cli.json:

  "apps": [
    {
      "root": "src",
      "outDir": "dist",
      "assets": [
        "assets",
        "favicon.ico"
      ],
      "index": "index.html",
      "main": "main.ts",
      "polyfills": "polyfills.ts",
      "test": "test.ts",
      "tsconfig": "tsconfig.app.json",
      "testTsconfig": "tsconfig.spec.json",
      "prefix": "app",
      "styles": [
        "styles.css"
      ],
      "scripts": [],
      "environmentSource": "environments/environment.ts",
      "environments": {
        "dev": "environments/environment.ts",
        "prod": "environments/environment.prod.ts"
      }
    },
    {
      "root": "src2",
      "outDir": "dist",
      "assets": [
        "assets",
        "favicon.ico"
      ],
      "index": "../src/index.html",
      "main": "main2.ts",
      "polyfills": "../src/polyfills.ts",
      "tsconfig": "../src/tsconfig.app.json",
      "prefix": "app",
      "environmentSource": "../src/environments/environment.ts",
      "environments": {
        "dev": "../src/environments/environment.ts",
        "prod": "../src/environments/environment.prod.ts"
      }
    }
],

Observed behavior

image

Transcript:

ERROR in ./src2/main2.ts.
Module build failed: Error: ..\multi-app-shared\src2\main2.ts is not part of the compilation output. Please check the other error messages for details.

Desired behavior

Bootstrap the application as intended.

Mention any other details that might be useful (optional)

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentseverity3: broken

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions