Primeng: Got error TS-996002 when build with Ivy - Angular 8.1

Created on 4 Jul 2019  路  21Comments  路  Source: primefaces/primeng

I just update Angular 8.1 from 7.1, set enableIvy true in file tsconfig.app.json. Then run "ng build", and I got lots of errors as below.


ERROR in ../node_modules/primeng/components/button/button.d.ts:28:22 - error TS-996002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class

28 export declare class ButtonModule {

../node_modules/primeng/components/inputtext/inputtext.d.ts:12:22 - error TS-996002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class

12 export declare class InputTextModule {
~~~
../node_modules/primeng/components/dropdown/dropdown.d.ts:153:22 - error TS-996002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class

153 export declare class DropdownModule {

------------------------------------------------------------

  • Angular version: 8.1.0

    "@angular/animations": "~8.1.0",
    "@angular/cdk": "^8.0.2",
    "@angular/common": "~8.1.0",
    "@angular/compiler": "~8.1.0",
    "@angular/core": "~8.1.0",
    "@angular/forms": "~8.1.0",
    "@angular/platform-browser": "~8.1.0",
    "@angular/platform-browser-dynamic": "~8.1.0",
    "@angular/router": "~8.1.0",
    "primeng": "8.0.0",
    "@angular/cli": "~8.1.0",
    "@angular/compiler-cli": "~8.1.0",
    "typescript": "3.4.5"

  • PrimeNG version: 8.0.0

  • Browser: Chrome XX

  • Language: [all | TypeScript 3.4.5 | ES5]

  • Node (for AoT issues): node --version = v11.5.0

Most helpful comment

@cagataycivici As Angular 9 will be released soon (and Ivy will be the default renderer there), any idea on when PrimeNG will be an Ivy-compatible library?

All 21 comments

It also fails under angular next 8.2.0.

In the 8.0 blog they state PrimeNG currently doesn't work with ivy and they are working on making it compatible. I would recommend not using ivy yet if you plan on using PrimeNG - https://www.primefaces.org/primeng-8-0-0-released/

Ivy will not work at now.
We have 2 options here,
a) primeng team fix how the package is upload to npm:
https://github.com/angular/angular/issues/30565
probably fixed using https://github.com/ng-packagr/ng-packagr
b) Angular team fixes how ngcc works:
https://hackmd.io/qn0asUnzTHWHj8s5Nn5iFA

@cagataycivici
Can you create an Ivy issue ? I told you previously in 7761, so we can track the Ivy progress

Hi @jmesa-sistel

I have the same issue with Angular 8.2.0-next.1 . However Angular compiler complains not only about PrimeNG modules but also about my own modules. How can I fix it?

70 export class SharedModule {
~~~~
app/general/general.module.ts:20:14 - error TS-996002: Appears in the NgModule.imports of AppModule, but itself has errors

@sergey-morenets But are you using primeng in your app?
In my tests not using primeng at all I have no errors.

@jmesa-sistel Yes, I'm using Primeng and still can't use Ivy renderer for my project.

@sergey-morenets At now it is impossible use primeng with Ivy.
The primeng team (I guess @cagataycivici) has to work on the library to make it compatible.

I'm looking forward to this update :-), I'm used to fork old libs and make them compatible with ivy, but primeng is too big to do so... I have a couple of project stuck in their migration process because of this :'(.

Same issue with the ChartModule:

ERROR in ../node_modules/primeng/components/chart/chart.d.ts:26:22 - error TS-996002: Appears in the NgModule.imports of HomepageModule, but could not be resolved to an NgModule class

26 export declare class ChartModule {
                        ~~~~~~~~~~~
../node_modules/primeng/components/chart/chart.d.ts:26:22 - error TS-996002: Appears in the NgModule.imports of ApplicationsModule, but could not be resolved to an NgModule class

26 export declare class ChartModule {
                        ~~~~~~~~~~~
../node_modules/primeng/components/chart/chart.d.ts:26:22 - error TS-996002: Appears in the NgModule.imports of SystemModule, but could not be resolved to an NgModule class

26 export declare class ChartModule {
                        ~~~~~~~~~~~
../node_modules/primeng/components/chart/chart.d.ts:26:22 - error TS-996002: Appears in the NgModule.imports of DebuggingModule, but could not be resolved to an NgModule class

26 export declare class ChartModule {
                        ~~~~~~~~~~~
app/admin/discovery/discovery.module.ts:46:14 - error TS-996002: Appears in the NgModule.imports of CreateCustomRuleModule, but itself has errors

46 export class DiscoveryModule { }
                ~~~~~~~~~~~~~~~
../node_modules/primeng/components/chart/chart.d.ts:26:22 - error TS-996002: Appears in the NgModule.imports of DiscoveryModule, but could not be resolved to an NgModule class

26 export declare class ChartModule {

Issue still reproduces with Angular 8.2.0 and PrimeNG 8.0.2

In other library (angular-froala-wysiwyg), i faced similar issue and fixed the issue with ng-packagr library build. Primeng should use ng-packagr for building ng library. it seems angular.json not include ng-packagr configuration for library build.

when we use ng-packagr, it will create ESM5, ESM2015, FESM5, FESM2015 bundles. Ivy compiler require ESM, FESM to compile because Angular support differential module loading (https://angular.io/guide/deployment#differential-loading). But, primeng now only support fesm5 build.

@cagataycivici As Angular 9 will be released soon (and Ivy will be the default renderer there), any idea on when PrimeNG will be an Ivy-compatible library?

@cagataycivici you could add primeng here: https://github.com/angular/ngcc-validation/tree/master/projects and will help you fix whatever problem you have migrating

still having similar issue with angular 8.2.8 and primeng 8.04

Any news on this? Angular 9 rc 1 was released this week and Ivy compatibility is still missing. :/

Should be fixed with next week's PrimeNG 9.0.0-rc1, if not please create a new ticket.

Should be fixed with next week's PrimeNG 9.0.0-rc1, if not please create a new ticket.

Unfortunately it is not fixed even for official 9.0.0.

Should be fixed with next week's PrimeNG 9.0.0-rc1, if not please create a new ticket.

Unfortunately it is not fixed even for official 9.0.0.

@schungx I just migrated to Angular 9.0 and Primeng 9.0-rc.4 and didn't have any issues with the build.

@schungx I just migrated to Angular 9.0 and Primeng 9.0-rc.4 and didn't have any issues with the build.

Sorry, I wasn't clear. I just mentioned that the problem still exists -- I had it with another library.

so, for now, we can't use prime ng with angular 8? any alternative?

It works fine now, You can use primeng9 fully compatible with ivy :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SchneMa picture SchneMa  路  3Comments

KannanMuruganmony picture KannanMuruganmony  路  3Comments

Faigjaz picture Faigjaz  路  3Comments

watalberto picture watalberto  路  3Comments

jisqaqov picture jisqaqov  路  3Comments