4

我用角 9,primeng 9

我有我的模块: ItemModule:

import { CalendarModule } from 'primeng/calendar';

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

但我得到错误:

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 {

我在那里看到文档,这个版本的primeng应该与angular 9 ivy兼容。

你对此有什么想法吗?提前谢谢。

4

2 回答 2

3

在 tsconfig.json 中添加:

"angularCompilerOptions": {
    "fullTemplateTypeCheck": true,
    "strictInjectionParameters": true,
    **"enableIvy": false**
}
于 2020-05-03T00:03:13.707 回答
1

将版本升级primeng到 9.xx(例如 - 9.1.3)。

ngcc这将在下面 angular的帮助下根据需要预编译模块。

如果你依赖于许多 Angular 库,你可以考虑通过在 npm postinstall 脚本中调用 ngcc(Angular Compatibility Compiler)来加速你的构建,方法是对你的 package.json 做一些小的改动

于 2020-09-12T09:01:15.323 回答