Get `Cannot read property 'type' of null` using Angular2 AoT ngc compiler with RC5

前端 未结 2 1317
北荒
北荒 2021-01-27 21:02

Update to Angular2 2.0.0-rc.5, run in browser without any warning, but when try AOT compile with ngc -p command, get the flowing error:

Here is my

2条回答
  •  情书的邮戳
    2021-01-27 21:36

    Do not use default exports in your code:

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

    use explicit names instead

    // somefile.ts
    export function whatevar(...) {
        ...
    }
    ...
    // some-other-file.ts
    import { whatevar } from './somefile';
    

    AOT is incompatible with default exports (among other things). But unlike other incompatibilities, this one generates the most cryptic error message ever.

提交回复
热议问题