angular: primeng not working with ngcc

🐞 Bug report

Command (mark with an x)

ng build --prod

Is this a regression?



I have a project with PrimeNg dependency. When I upgraded to 8.0.0-rc.1 my project compiled properly. But if I enable Ivy flag in tsconfig.json:

“angularCompilerOptions”: { “enableIvy”: true, “allowEmptyCodegenFiles”: true },

I get a lot of error messages about incorrect module usage when I build the project.

🔬 Minimal Reproduction

  1. Create new project with Angular CLI 8.0.0-rc.1
  2. Add Primeng dependency and import its modules into AppModule.

🔥 Exception or Error

ERROR in node_modules/primeng/components/confirmdialog/confirmdialog.d.ts(64,22): error TS-996002: Appears in the NgModule.imports of SharedModule, but could not be resolved to an NgModule class
node_modules/ngx-filter-pipe/src/app/shared/ngx-filter-pipe/ngx-filter.module.d.ts(1,22): error TS-996002: Appears in the NgModule.imports of SharedModule, but could not be resolved to an NgModule class

🌍 Your Environment

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

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

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 4
  • Comments: 24 (15 by maintainers)

Most upvoted comments

@sergey-morenets at this moment, I’m afraid you can’t yet. We are still experiencing incompatibilities with ngcc for packages that do not follow APF (Angular Package Format), of which PrimeNG is one example. We are working on resolving those incompatibilities in ngcc though.

@speige Any updates on this? PrimeNG team recently released 8.0 but it’s not compatible with Angular 8.2.0-next.1 in Ivy mode.

@sergey-morenets You might consider opening an issue with primeng asking them to use when publishing to npm. I’m the author of & my library also broke ivy until I used ng-packagr.

Any updates on this?

I think that an ngcc config file that will be placed in the project using such a package could solve this issue. The config could specify what typings file to use for a given entry-point path.

From analyzing other sitatuations where ngcc did not process a package, I see two causes why PrimeNG is not being processed:

  1. There’s no typings key in its package.json
  2. Typing files shadow the JavaScript sources

It works for me in 9.0.0-rc3 and rc4 (didn’t work before)

Hi @speige

I would love to do that. But I doubt I have enough technical skills to explain in details what should be changed on PrimeNg side. I guess the Angular team member will do it better and in cleaner way.

I also found an issue that might relate to the current ticket:

The above error typically means that ngcc didn’t run.

Will have a look at it in the coming days.