HalitTalha / ng-material-extensions

Extended features for @angular/material components
Apache License 2.0
101 stars 52 forks source link

ERROR in node_modules/mat-table-exporter/lib/mat-table-exporter.module.d.ts:1:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class. #60

Closed itayperry closed 4 years ago

itayperry commented 4 years ago

Hi, I'm working with

Angular 9.1.3

I got this error immediately after installing the mat-table-exporter: (I used npm install --save mat-table-exporter) " ERROR in node_modules/mat-table-exporter/lib/mat-table-exporter.module.d.ts:1:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class."

It also said: " This likely means that the library (mat-table-exporter) which declares MatTableExporterModule 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."

HalitTalha commented 4 years ago

mat-table-exporter and other ng-material-extension packages are not Ivy compiled however they should be compatible. For the time being you can disable Ivy if it is possible in your case.

itayperry commented 4 years ago

Thank you so much for your fast reply! I might need to use Ivy in the near future. Any idea how long it would take for ng-material-extension to be Ivy compiled? If it’s being planned or something.. and thanks again for your answer.

HalitTalha commented 4 years ago

Thank you for the feedback 👍 Actually it is nothing to do with the Ivy in our case. If a library is compiled with Ivy, non-ivy applications can not use it. That's why Angular team does recommend library authers to keep going with the old view-engine untill Angular 10. Because a view-engine compiled library can be used by both ivy and view engine compiled applications. I couldn't have the chance to reproduce your case yet but it seems somehow ng-material-extensions implies an incompatibility with ngcc (Angular compatibility compiler) I believe I can resolve this this week before our planned patch release.

itayperry commented 4 years ago

So maybe I got it all wrong, perhaps it's truly an ngcc compatibility issue. I wasn't aware of Angular's recommendations for the authors and that

"view-engine compiled library can be used by both ivy and view engine compiled applications."

Thank you for explaining all of this :) Should I reinstall in a week or two and try it out?

HalitTalha commented 4 years ago

I finally got the time to check and validate the packages are ivy compatible. If your issue is still there could you send your package.json?

You can take a look at this example project which is in Angular 9.1.3 version as in your case. https://github.com/HalitTalha/ivy-testing

HalitTalha commented 4 years ago

Closing due to inactivity.