与Visualular 2编译器配合使用的Typescript 2.1无法编译项目文件(无输出)

时间:2016-10-28 16:39:48

标签: angular typescript angular2-compiler

使用以下打字稿和角度编译器配置:

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
  }
}

/ compiled目录只包含/ node_modules / @ angular,而缺少所需的ngfactory文件的/ app目录。编译以静默方式结束,没有错误也没有输出。

它适用于Typescript 2.0,但是我想在针对es5时使用2.1 for async / await支持,从而消除了使用babel的额外编译步骤。

[编辑]

仅在Typescript 2.1.0-dev.20160907之后和之后发生,恰好在实现异步/等待支持时。我猜它是该版本中的一个变更之一ngc; 2.1.0-dev.20160906仍然有效。

[EDIT2]

如果有人尝试使用带有打字稿2.1的ngc,如果它适用于您,您是否可以留下简短的评论?这至少会告诉我问题是否与我的配置有关。

1 个答案:

答案 0 :(得分:4)

问题源于v2.1中对typescript的一些内部更改,这些更改未在angular tsc-wrapper中解决。

它已在此pull request中得到修复。合并后,文件应该再次正常编译。