4

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.

Kesarion
  • 2,808
  • 5
  • 31
  • 52
  • I'm not an expert with Typescript, but I recall seeing something about `outDir` having strange effects on Angular 2; what kind of output do you see in that `tmp` directory? – Claies Oct 28 '16 at 17:21
  • The `tmp` directory contains the compiled (js + map) files from `app`. Same behavior without the `outDir` option though, `compiled` doesn't have any app files, only node_modules. – Kesarion Oct 28 '16 at 18:42
  • I faced the same problem yesterday with Typescript 2.1 and Angular 2.3.0 without specifying `outDir` in my tsconfig.json. Switching back to 2.0.x Typescript works so it's not Angular's fault as far as I can tell. – Corey Ogburn Dec 08 '16 at 19:51
  • JiT compiling seems to work fine. I think the problem lies in AoT compilation, probably `ngc` specifically. – Corey Ogburn Dec 08 '16 at 20:04

1 Answers1

4

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.

Kesarion
  • 2,808
  • 5
  • 31
  • 52