4

I use angular 9, primeng 9

I have my module : ItemModule :

import { CalendarModule } from 'primeng/calendar';

@NgModule({
    imports: [
       CalendarModule
       .....
    ],
    .....
})

But I get the error :

ERROR in node_modules/primeng/components/calendar/calendar.d.ts:246:22 - error NG6002:  
Appears in the NgModule.imports of ItemModule, but could not be resolved to an NgModule class.

This likely means that the library (primeng/calendar) which declares CalendarModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. 
Check if a newer version of the library is available, and update if so. 
Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

246 export declare class CalendarModule {

I saw in there doc, this version of primeng should be compatible with angular 9 ivy.

Have you an idea about that ? Thx in advance.

frint
  • 771
  • 1
  • 7
  • 14

2 Answers2

3

Add in tsconfig.json:

"angularCompilerOptions": {
    "fullTemplateTypeCheck": true,
    "strictInjectionParameters": true,
    **"enableIvy": false**
}
Sandeep Kumar
  • 2,397
  • 5
  • 30
  • 37
  • It doesn't look like an ultimate solution. Primeng 9 should be compatible with Angular 9 usinng Ivy. I don't feel like disabling Ivy only because of this one library. – julew Aug 05 '20 at 07:41
1

Upgrade primeng version to 9.x.x (example - 9.1.3).

This will pre-compile the modules as per the need with the help of ngcc as stated by angular below.

If you depend on many Angular libraries you may consider speeding up your build by invoking the ngcc (Angular Compatibility Compiler) in an npm postinstall script via small change to your package.json.