解决ImageCropperComponent发布报错
ng serve可以正常运行,npm run build 就会报错:
ERROR in : Type ImageCropperComponent in -/node_modules/ng2-img-cropper/src/imageCropperComponent.d.ts is part of the declarations of 2 modules: ImageCropperModule in -/node_modules/ng2-img-cropper/src/imageCropperModule.d.ts and TicketauditModule in -/src/app/routes/ticketaudit/ticketaudit.module.ts! Please consider moving ImageCropperComponent in -/node_modules/ng2-img-cropper/src/imageCropperComponent.d.ts to a higher module that imports ImageCropperModule in -/node_modules/ng2-img-cropper/src/imageCropperModule.d.ts and TicketauditModule in -/src/app/routes/ticketaudit/ticketaudit.module.ts. You can also create a new NgModule that exports and includes ImageCropperComponent in -/node_modules/ng2-img-cropper/src/imageCropperComponent.d.ts then import that NgModule in ImageCropperModule in -/node_modules/ng2-img-cropper/src/imageCropperModule.d.ts and TicketauditModule in -/src/app/routes/ticketaudit/ticketaudit.module.ts.
错误原因:在 module.ts 声明时使用了ImageCropperComponet
解决办法:改用 ImageCropperModule 声明
ImageCropperComponent and AOT #95