Skip to content

NGCC only transforms top level modules #30121

Closed

Description

@alan-agius4

@gkalpak and myself saw the below issue when running tests under ivy

Error: ASSERTION ERROR: NgModule 'CompilerModule' is not a subtype of 'NgModuleType'.
    at throwError (http://localhost:9876/_karma_webpack_/vendor.js:62601:11)
    at assertDefined (http://localhost:9876/_karma_webpack_/vendor.js:62595:9)
    at new NgModuleRef$1 (http://localhost:9876/_karma_webpack_/vendor.js:86038:22)
    at NgModuleFactory$1.create (http://localhost:9876/_karma_webpack_/vendor.js:86109:16)

It seems the issue is that NGCC only transforms top level modules.

@NgModule({providers})
class CompilerModule {
}
const CompilerModuleFactory = new R3NgModuleFactory(CompilerModule);
this._injector = CompilerModuleFactory.create(this.platform.injector).injector;
return this._injector;

with ngcc the output of it is

        class CompilerModule {
        }
        CompilerModule.decorators = [
            { type: NgModule, args: [{ providers },] },
        ];
        /** @type {?} */
        const CompilerModuleFactory = new ɵNgModuleFactory(CompilerModule);
        this._injector = CompilerModuleFactory.create(this.platform.injector).injector;
        return this._injector;

Activity

  1. added this to the needsTriage milestone on Apr 25, 2019
  2. 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.

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

    area: coreIssues related to the framework runtime

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions