Skip to content

Tour of Heroes doesn't compile with Ivy and angular-in-memory-web-api #28603

Closed

Description

@brandonroberts

🐞 bug report

Affected Package

The issue is caused by package @angular/....

Is this a regression?

Yes

Description

A clear and concise description of the problem...

When using Ivy/ngcc with angular-in-memory-api version 0.8.0, the app does not compile and emits an error.

The app currently works under V7 and V8 without Ivy with no issues.

🔬 Minimal Reproduction

https://github.com/brandonroberts/ivy-in-memory

Instructions to reproduce are in the README

🔥 Exception or Error





```
ERROR in Value at position 4 in imports array is not a reference: [object Object]
```

🌍 Your Environment

Angular Version:




Angular CLI: 7.1.4
Node: 10.14.2
OS: linux x64
Angular: 8.0.0-beta.3
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.11.4
@angular-devkit/build-angular     0.11.4
@angular-devkit/build-optimizer   0.11.4
@angular-devkit/build-webpack     0.11.4
@angular-devkit/core              7.1.4
@angular-devkit/schematics        7.1.4
@angular/cli                      7.1.4
@ngtools/webpack                  7.1.4
@schematics/angular               7.1.4
@schematics/update                0.11.4
rxjs                              6.3.3
typescript                        3.1.6
webpack                           4.23.1

Anything else relevant?

I did an additional build of angular-in-memory-web-api with ng-packagr and 8.0.0-beta.3 and the app works correctly under Ivy/ngcc.

Build repo is here: https://github.com/brandonroberts/in-memory-web-api-bazel
Build branch is here: https://github.com/brandonroberts/in-memory-web-api/tree/ng-packagr-build

cc: @kara @IgorMinar @petebacondarwin

Activity

  1. alexzuza commented on Feb 7, 2019

    @alexzuza
    Contributor

    Ivy compiler does not resolve ModuleWithProviders yet.

    HttpClientInMemoryWebApiModule.forRoot(
      InMemoryDataService, { dataEncapsulation: false }
    )
    

    // TODO(alxhub): expand ModuleWithProviders.
    throw new Error(`Value at position ${idx} in ${name} array is not a reference: ${entry}`);

    cc @alxhub

  2. alxhub commented on Feb 7, 2019

    @alxhub
    Member

    I think that TODO is incorrect, we do indeed process ModuleWithProviders (a few lines above, actually, with another comment).

  3. added this to the needsTriage milestone on Feb 8, 2019
  4. petebacondarwin commented on Feb 8, 2019

    @petebacondarwin
    Contributor

    But it looks like the error that is being reported in this issue comes from that line.

  5. brandonroberts commented on Apr 10, 2019

    @brandonroberts
    ContributorAuthor

    I'm still seeing this issue with the latest beta(11). Was #29119 supposed to fix this issue @JoostK?

    Angular CLI: 8.0.0-beta.11
    Node: 10.15.3
    OS: linux x64
    Angular: 8.0.0-beta.11
    ... animations, cli, common, compiler, compiler-cli, core, forms
    ... language-service, platform-browser, platform-browser-dynamic
    ... router
    
    Package                           Version
    -----------------------------------------------------------
    @angular-devkit/architect         0.800.0-beta.11
    @angular-devkit/build-angular     0.800.0-beta.11
    @angular-devkit/build-optimizer   0.800.0-beta.11
    @angular-devkit/build-webpack     0.800.0-beta.11
    @angular-devkit/core              8.0.0-beta.11
    @angular-devkit/schematics        8.0.0-beta.11
    @ngtools/webpack                  8.0.0-beta.11
    @schematics/angular               8.0.0-beta.11
    @schematics/update                0.800.0-beta.11
    rxjs                              6.4.0
    typescript                        3.3.4000
    webpack                           4.29.6
    
  6. brandonroberts commented on Apr 10, 2019

    @brandonroberts
    ContributorAuthor
  7. JoostK commented on Apr 11, 2019

    @JoostK
    Member

    @brandonroberts Hmm, seeing that angular-in-memory-web-api also has that InMemoryWebApiModule_1 indirection going on it should be supported with #29119. I'm not sure what would prevent this from working this time around, I'll need to take a look at it.

  8. self-assigned this
    on Apr 11, 2019
  9. JoostK commented on Apr 13, 2019

    @JoostK
    Member

    Okay, I ran through the repro and have found the culprit on why angular-in-memory-web-api is causing problems. The root issue is that its package.json does not specify a typings nor types issue, which ngcc tests as a prerequisite for processing an entry-point:

    // We must have a typings property
    const typings = entryPointPackageJson.typings || entryPointPackageJson.types;
    if (!typings) {
    return null;
    }

    The null return causes the entry-point to be dropped from further processing, as it is considered not to be an Angular package at all.

  10. removed their assignment
    on Apr 14, 2019
  11. JoostK commented on Apr 28, 2019

    @JoostK
    Member

    Tracked as FW-1299

  12. 16 remaining items

  13. added a commit that references this issue on Jun 24, 2019
    00ff66e
  14. added a commit that references this issue on Jun 26, 2019
    cdda88d
  15. 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.

  16. 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

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions