Skip to content

AoT with typescript@2.1.1 fails #12966

Closed
Closed

Description

@blaugold

I'm submitting a ... (check one with "x")

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior
When compiling project with ngc and typescript@2.1.1 compilation fails with:
Metadata emit requires the sourceFiles are passed to WriteFileCallback. Update to TypeScript ^1.9.0-dev

When downgrading typescript to 2.0.10 the compilation is successful.

Expected behavior
ngc should compile project with typescript@2.1.1.

Minimal reproduction of the problem with instructions

What is the motivation / use case for changing the behavior?

Please tell us about your environment:
macOS@10.12.1
node@v6.9.1
angular@2.2.1
typescript@2.1.1

  • Angular version: 2.0.X

Yes.

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
  • Language: [all | TypeScript X.X | ES6/7 | ES5]
    TypeScript 2.1.1

  • Node (for AoT issues): node --version =

Activity

  1. DzmitryShylovich commented on Nov 18, 2016

    @DzmitryShylovich
    Contributor

    Pls provide a minimal repo with reproduction.

  2. blaugold commented on Nov 18, 2016

    @blaugold
    Author

    This repo has two branches: ts-2.1.1 and ts-2.0.10.

    • checkout the branch
    • run rm -rf node_modules && npm i or yarn
    • run npm run build

    ts-2.0.10 compiles fine, ts-2.1.1 gives me the mentioned error.

  3. rubber-duck commented on Nov 18, 2016

    @rubber-duck

    In my case running ngc does not fail with an error but the output directory only contains AoT files for node_modules.

    Using the typescript 2.0.x produces correct/expected output.

    You can check out the project here - do npm run ngc and it will create correct output in the build/aot folder, upgrade to typescript 2.1.x and retry and you will only see build/aot/node_modules.

    I would really like to get babel out of my build process and TS 2.1 finally implements ES5 async/await emit but this is a blocking issue before upgrading (I've also seen closed issues reporting the same problem without a solution eg. #11689)

  4. blaugold commented on Nov 18, 2016

    @blaugold
    Author

    @rubber-duck The repo you reference uses "skipMetadataEmit": true which passes since the compiler never tries to emit the metadata but I too only see node_modules and non of the projects factories.

  5. rubber-duck commented on Nov 18, 2016

    @rubber-duck

    @blaugold I tried removing that line to see if I could reproduce before I posted and I couldn't get the error (I'm on windows btw.)

    But in either case the AoT doesn't work with TS 2.1

  6. gustavLatte commented on Nov 20, 2016

    @gustavLatte

    In my case, similar to @rubber-duck the AOT output folder contained only the angular and angularfire2 folders under the node_modules folder.

  7. jimmytheneutrino commented on Nov 24, 2016

    @jimmytheneutrino

    I did a little debugging on rubber-duck's problem.
    One of the reasons seems to be line 187 in tsc-wrapped's collector.js:
    if (node.flags & ts.NodeFlags.Export) {
    Here, ts.NodeFlags.Export is undefined in Typescript 2.1.

    This corresponds to the line in the source.

  8. imcotton commented on Nov 25, 2016

    @imcotton
    Contributor

    @jimmytheneutrino thank you for the hint

    I've made further digging, it turns out in TS v2.1 should use ModifierFlags instead of NodeFlags, I opened PR #13081 as first step of migration, once goes merged could easily make the final change as showed in draft PR imcotton#1.

  9. added a commit that references this issue on Dec 1, 2016
  10. actra-gschuster commented on Dec 1, 2016

    @actra-gschuster

    I digged deep into a similiar issue today - ng-xi18n did produce my .xlf file but it had no content.
    TypeScript changed the "NodeFlags" ENUM, in 2.0.10 it was "Export", in ^2.1 it is "ExportContext".
    There where more changes like these so currently NG2 isn't (fully) compatible with TS ^2.1
    Downgrading TS to 2.0.10 currently solved my problem.

  11. added a commit that references this issue on Dec 2, 2016
  12. lacolaco commented on Dec 8, 2016

    @lacolaco
    Contributor

    Relates to #13204

  13. jamespacileo commented on Dec 13, 2016

    @jamespacileo

    Any news on this issue? Ionic framework suffers from the same issue.

  14. lacolaco commented on Dec 13, 2016

    @lacolaco
    Contributor

    @jamespacileo they're working on this. see #13294

  15. added 2 commits that reference this issue on Jan 18, 2017
  16. angular-automatic-lock-bot commented on Sep 10, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  17. locked and limited conversation to collaborators on Sep 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: coreIssues related to the framework runtime

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions