Skip to content

Compilation error in Ivy mode with 8.0.0-rc.5 #30680

Closed

Description

@sergey-morenets

🐞 bug report

Is this a regression?

No

Description

I have a working Angular v7 application with the following dependency:
"angular-star-rating": "^3.0.8"

If I upgrade my application to the 8.0.0-rc.5 version it builds fine. But if enable Ivy mode in tsconfig.json


  "angularCompilerOptions": {
    "enableIvy": true
  },

I start getting this error message during build.

🔬 Minimal Reproduction

ng build --prod

🔥 Exception or Error


ERROR in ENOENT: no such file or directory, open 'node_modules/angular-star-rating/angular-star-rating.js'

🌍 Your Environment

Angular Version:


Angular CLI: 8.0.0-rc.4
Node: 11.3.0
OS: win32 x64
Angular: 8.0.0-rc.5
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.800.0-rc.4
@angular-devkit/build-angular     0.800.0-rc.4
@angular-devkit/build-optimizer   0.800.0-rc.4
@angular-devkit/build-webpack     0.800.0-rc.4
@angular-devkit/core              8.0.0-rc.4
@angular-devkit/schematics        8.0.0-rc.4
@angular/cdk                      8.0.0-rc.2
@angular/cli                      8.0.0-rc.4
@angular/http                     8.0.0-beta.10+1.sha-a28b3e3
@angular/material                 8.0.0-rc.2
@ngtools/webpack                  8.0.0-rc.4
@schematics/angular               8.0.0-rc.4
@schematics/update                0.800.0-rc.4
rxjs                              6.5.2
typescript                        3.4.5
webpack                           4.30.0

Activity

  1. JoostK commented on May 27, 2019

    @JoostK
    Member

    Unfortunately, I can't reproduce without a repo. Locally installing angular-star-rating and running ngcc completes successfully. Could you provide a Github repo we may clone?

  2. added this to the needsTriage milestone on May 27, 2019
  3. sergey-morenets commented on May 29, 2019

    @sergey-morenets
    Author

    Hi @JoostK

    First of all, I didn't run ngcc, I ran ng build --prod command as I mentioned in the description.
    But I noticed that you released 8.0 yesterday so I tried to upgdate my project again:

    ng update --force=true --packageManager=yarn @angular/cli @angular/core

    Unfortunately if I run ng build --prod or node_modules/.bin/ivy-ngcc I still get this exception.

  4. sergey-morenets commented on May 29, 2019

    @sergey-morenets
    Author

    I will try to create sample repo to reproduce the error but it may take some time

  5. sergey-morenets commented on May 29, 2019

    @sergey-morenets
    Author

    Hi @JoostK

    I created sample repo from clean new Angular 8 project, can you please look at it: https://github.com/sergey-morenets/angular8

    If I set "enableIvy": false in tsconfig.json then ng build --prod command worked successfully. And if change it to "enableIvy": true then I get error message, but a different one:

    ERROR in node_modules/angular-star-rating/src/angular-star-rating.module.d.ts(2,22): error TS-996002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class

  6. JoostK commented on May 29, 2019

    @JoostK
    Member

    I understand that you didn't run ngcc, so that's why the reproduction was required for me to be able to run ng build --prod. The error you experience now does seem to indicate that ngcc did not process angular-star-rating. Could you check for me if you have @angular/forms installed? It is a peer dependency of angular-star-rating and if it's not installed, angular-star-rating is not processed.

  7. sergey-morenets commented on May 29, 2019

    @sergey-morenets
    Author

    @JoostK
    Yes, it's installed. But actually you can clone my repo and reproduce the issue.

  8. JoostK commented on May 29, 2019

    @JoostK
    Member

    Thanks 👍 Will have a look later.

  9. JoostK commented on May 29, 2019

    @JoostK
    Member

    It looks like the angular-star-rating package is not properly processed by ngcc, as it uses an old tsickle syntax for the decorator metadata.

    Look for StarRatingModule.decorators in its ES5 bundle, you'll find it at the root of the module. With more recent versions of tsickle, that statement is instead emitted within the IIFE. At this moment, ngcc only searches for decorator metadata within the IIFE, not at the root. Hence, no Ivy code is generated for the package, resulting in the error.

  10. sergey-morenets commented on May 30, 2019

    @sergey-morenets
    Author

    @JoostK

    Ok, so you will fix this issue in the next Angular build?

  11. IlCallo commented on May 30, 2019

    @IlCallo

    Seems more like an update the library maintainer have to fix, than Angular team

  12. JoostK commented on May 30, 2019

    @JoostK
    Member

    @sergey-morenets We should be able to support this structure. I don't think it will be in the next build though.

  13. sergey-morenets commented on May 30, 2019

    @sergey-morenets
    Author

    @IlCallo This library is not actively maintained (like many others) so I guess the best option here is not to force library creators to migrate to new format but to ask for Anguar team support of these libraries.
    Does this make sense for you?

  14. JoostK commented on May 31, 2019

    @JoostK
    Member

    I opened PR #30795 that should get this supported. Unfortunately, we hit a restriction in TypeScript that currently requires an awful hack to workaround, so this might not get in shortly.

  15. modified the milestones: needsTriage, Backlog on Jun 3, 2019
  16. JoostK commented on Jun 19, 2019

    @JoostK
    Member

    I just retested this with 8.1.0-next.3 and the issue has indeed been resolved with #30795. I forgot to link this issue from that PR so it wasn't auto-closed, I'll do that now.

  17. angular-automatic-lock-bot commented on Sep 15, 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.

  18. locked and limited conversation to collaborators on Sep 15, 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

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions