amitdahan / ngx-filesize

filesize.js pipe wrapper for Angular

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for Angular 9

varun9690 opened this issue · comments

I am seeing the below error and compilation fails, the app is currently using @angular/core": "9.1.0": NG6001: Cannot declare 'NgxFilesizeModule' in a NgModule as it's not a part of the current compilation. Can you please help with this?

Hey thanks! So you're saying any Angular 9 project is blocked from using the package?

Checking!
In the meanwhile, in case it doesn't reproduce, is the repo this happens in, public? Can I clone & try?

Thanks for checking. I will actually take that back, surprisingly it worked this morning. This is what I have changed:
Moved the import to shared.module.ts and instead of adding it to 'imports', adding to 'exports'. Here is now the module looks:

@NgModule({ declarations: [ ..., ], imports: [ ..., CommonModule, ], exports: [ ..., NgxFilesizeModule, ], })

Hmm so you had to use the library differently?

It's just because you installed the library while ng serve was running. Restart the server to include the library in the compilation.
There is no need to create a shared module.