angulartypescriptangular2-compiler

Typescript 2.1 coupled with the Angular 2 compiler silently fails to compile project files (no output)


Using the following typescript and angular compiler configuration:

tsconfig.json

{
  "compilerOptions": {
    "target": "es5",
    "module": "es2015",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "noEmitHelpers": true,
    "skipDefaultLibCheck": true,
    "strictNullChecks": false,
    "outDir": "tmp"
  },
  "exclude": [
    "node_modules",
    "compiled",
    "app/main.ts"
  ],
  "angularCompilerOptions": {
    "genDir": "compiled",
    "skipMetadataEmit" : true
  }
}

The /compiled directory only contains /node_modules/@angular, while the /app directory with the required ngfactory files is missing. The compilation ends silently, with no errors and no output.

It works just fine with Typescript 2.0, but I would like to use 2.1 for async/await support while targeting es5, thus eliminating an extra compile step with babel.

[Edit]

This happens only on and after Typescript 2.1.0-dev.20160907, exactly when async/await support is implemented. I'm guessing it's one of the changes in that version that broke ngc; 2.1.0-dev.20160906 still worked.

[Edit2]

If anyone's tried using ngc with typescript 2.1, could you leave a short comment if it works for you? That would at least tell me if the issue is with my configuration.


Solution

  • The issue stems from some internal changes to typescript in v2.1 that are not addressed in the angular tsc-wrapper.

    It's getting fixed in this pull request. When that's merged, files should compile normally again.