question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ModuleWithProviders broken in v10.0.0-next.8

See original GitHub issue

🐞 bug report

Affected Package

The issue is caused by package @angular/compiler-cli

Is this a regression?

Yes, the previous version in which this bug was not present was: 10.0.0-next.6 (maybe 10.0.0-next.7, skipped this one)

Description

ngcc fails to compile the NgModule.forRoot() of my library.

Seems to be introduced by #36948 (commit)

🔬 Minimal Reproduction

  1. git clone https://github.com/cyrilletuzi/angular-async-local-storage
  2. cd angular-async-local-storage
  3. git checkout ng10
  4. npm ci
  5. npm run build
  6. npm run unit

You can also see the error in this CI test.

Source code is here (it’s a very simple NgModule with a classic forRoot()).

🔥 Exception or Error


The identity given by StorageModule referenced in "static forRoot(config) {
            return {
                ngModule: StorageModule_1,
                providers: [...],
            };
        }" doesn't appear to be a "class" declaration.

🌍 Your Environment

Angular Version:


Angular: 10.0.0-next.8
... common, compiler, compiler-cli, core, platform-browser
... platform-browser-dynamic, router
Ivy Workspace: Yes

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.1000.0-next.6
@angular-devkit/build-angular      0.1000.0-next.6
@angular-devkit/build-ng-packagr   0.1000.0-next.6
@angular-devkit/build-optimizer    0.1000.0-next.6
@angular-devkit/build-webpack      0.1000.0-next.6
@angular-devkit/core               10.0.0-next.6
@angular-devkit/schematics         10.0.0-next.6
@angular/cli                       10.0.0-next.6
@ngtools/webpack                   10.0.0-next.6
@schematics/angular                10.0.0-next.6
@schematics/update                 0.1000.0-next.6
ng-packagr                         10.0.0-next.1
rxjs                               6.5.5
typescript                         3.9.2
webpack                            4.43.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
petebacondarwincommented, May 18, 2020

Indeed it is a bug in the Es2105ReflectionHost changes to deal with IIFE wrapped classes.

The StorageModule_1 identifier is declared as a var and so this is not picked up as the “alias declaration” of the “inner declaration”.

I’ll put together a fix tomorrow.

0reactions
angular-automatic-lock-bot[bot]commented, Jun 20, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ModuleWithProviders Migration - Angular
For this reason, Angular version 9 deprecates ModuleWithProviders without a generic type. A future version of Angular will remove the default generic type, ......
Read more >
Angular error - Generic type 'ModuleWithProviders<T ...
declare module "@angular/core" { interface ModuleWithProviders<T = any> ... Generic type 'ModuleWithProviders' requires 1 type argument(s).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found