I am trying to migrate this library https://github.com/flauc/angular2-notifications from Angular 2+ to Angular 9.
The original error was about the ModuleWithProviders
that has become a generic type, so I fixed it. I also had an error described here https://github.com/angular/angular/issues/32352 which i fixed with require('@angular/compiler-cli');
and now I'm facing another error:
../node_modules/@angular/common/common.d.ts:115:22 - error NG6002: Appears in the NgModule.imports of SimpleNotificationsModule, but could not be resolved to an NgModule class
It's pretty hard for me to understand what's going on since I've never built a library before, and the build with gulp appears to be kinda hacky, since this line ngc = require('@angular/compiler-cli/src/main').main
refers to a function that does not belong to the public API.
Edit:
Following the idea in the comments (and my own feeling), I tried to build without gulp:
- Created a
angular.json
file - Separated
index.ts
intopublic_api.ts
andsimple-notifications.module.ts
- Did some changes in the files and folders structure
But I still have the same exact error...
My attempt: https://github.com/youkouleley/angular2-notifications
I try to build this with ng build
, the scripts in package.json
have not been updated