使用带有RC5的Angular2 AoT ngc编译器获取"无法读取属性"类型的"null"

zhi*_*min 0 angular

更新到Angular2 2.0.0-rc.5,在没有任何警告的情况下在浏览器中运行,但是当使用ngc -p命令尝试AOT编译时,得到流动的错误:

在此输入图像描述

这是我的项目https://github.com/beginor/learning-angular2

小智 5

不要在代码中使用默认导出:

// somefile.ts
export default function (...) {
    ...
}
...
// some-other-file.ts
import whatevar from './somefile';
Run Code Online (Sandbox Code Playgroud)

使用显式名称代替

// somefile.ts
export function whatevar(...) {
    ...
}
...
// some-other-file.ts
import { whatevar } from './somefile';
Run Code Online (Sandbox Code Playgroud)

AOT与默认导出(以及其他内容)不兼容.但与其他不兼容性不同,这个会产生最隐秘的错误消息.