PrimeNG(Angular)模块在生产模式中缺失,但在开发模式中可用



我一直在开发一个使用PrimeNG作为UI组件的角度应用程序。最初,我使用Angular版本9和PrimeNG版本8,我可以毫无问题地进行部署。所以几个月前,我将PrimeNG版本更新到了10.0.5-rc1版本,因为我想要一些新功能。开发进展顺利,但当我试图在生产模式下构建我的角度应用程序时,使用任何PrimeNG组件的每个组件都会出现错误。我注意到的另一件事是,每当我试图从共享模块访问组件时,都找不到该组件,因为angular在生产模式下找不到共享模块。以下是抛出的错误类型的一部分。

35   templateUrl: './reservation.component.html',
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error occurs in the template of component ReservationComponent.
src/app/modules/sales/modules/pos/menus/home/reservations/reservation/reservation.component.html:390:65 - error NG8002: Can't bind to 'showCloseIcon' since it isn't a known property of 'p-overlayPanel'.
1. If 'p-overlayPanel' is an Angular component and it has 'showCloseIcon' input, then verify that it is part of this module.
2. If 'p-overlayPanel' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.
390 <p-overlayPanel #deletePaymentOverlayModal [dismissable]="true" [showCloseIcon]="true">
src/app/modules/sales/modules/pos/menus/home/reservations/reservation/reservation.component.ts:35:16
35   templateUrl: './reservation.component.html',
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error occurs in the template of component ReservationComponent.
src/app/modules/shared/pos/reservation-components/create-reservation/create-reservation.component.html:3:1 - error NG8001: 'app-create-edit-reservation' is not a known element:
1. If 'app-create-edit-reservation' is an Angular component, then verify that it is part of this module.
2. If 'app-create-edit-reservation' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
3 <app-create-edit-reservation></app-create-edit-reservation>

我已经尝试更新我的PrimeNG版本,现在是最新版本11.0.0-rc1。我还更新了我的angular和angular cli版本。

我该如何解决这个问题?

通过更改angular.json文件中的一些变量,我可以在生产模式下构建angular。

重构前的angular.json文件:

"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,

重构后的angular.json文件:

"namedChunks": false,
"aot": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": false,

我认为我需要在应用程序中纠正一些问题,也许可以去掉一些被摘掉的库等。

最新更新