[Ivy - 9.0.0-rc.1] Running `ngc` on a custom library throws error "Appears in the NgModule.imports of ..., but could not be resolved to an NgModule class"
See original GitHub issueπ bug report
Affected Package
@angular/common
but I expect that others can also have this issue.
Is this a regression?
Yes, running ngc
on a code of a library that uses Angularβs packages has always works and the correct .metadata.json files have been created.
Description
Running ngc
to generate the metadata.json
of my custom libraryβs source code fails when using the latest 9.0.0.x release, currently available in the @next tag at npm.
I am testing how to building my package will work when 9.0.0 comes out.
π¬ Minimal Reproduction
As this requires compiling with ngc
I have prepared a very simply package and you can download it here ngc issue.zip
Simply do the following:
- Extract the archive and open it in a terminal
- Install the npm packages with
npm install
- Trigger
ngc
by executing./node_modules/.bin/ngc
The following error is thrown:
π₯ Exception or Error
node_modules/@angular/common/common.d.ts:115:22 - error NG6002: Appears in the NgModule.imports of MyCommonModule, but could not be resolved to an NgModule class
115 export declare class CommonModule {
~~~~~~~~~~~~
node_modules/@angular/common/common.d.ts:115:22 - error NG6003: Appears in the NgModule.exports of MyCommonModule, but could not be resolved to an NgModule, Component, Directive, or Pipe class
115 export declare class CommonModule {
~~~~~~~~~~~~
π Your Environment
Angular Version:
Angular CLI: 9.0.0-rc.1
Node: 10.15.2
OS: darwin x64
Angular: 9.0.0-rc.1
... common, compiler, compiler-cli, core
Package Version
------------------------------------------------------
@angular-devkit/architect 0.900.0-rc.1 (cli-only)
@angular-devkit/core 9.0.0-rc.1 (cli-only)
@angular-devkit/schematics 9.0.0-rc.1 (cli-only)
@schematics/angular 9.0.0-rc.1 (cli-only)
@schematics/update 0.900.0-rc.1 (cli-only)
rxjs 6.5.3
typescript 3.6.4
Anything else relevant? I am hitting this error in preparation for Ivy and 9.0.0 of my custom Angular library. I would love some assistance before 9.0.0 is live because at the moment I cannot build my custom library when using Angular packages 9.0.0
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
@VladimirAmiorkov Ivy compiler is default compiler since 9.0.0-next.3(https://github.com/angular/angular/blob/master/CHANGELOG.md#breaking-changes-8). If you want to compile your library in ViewEngine mode then I would suggest you using
enableIvy
option in your tsconfig.jsonThis 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.