I am getting an error in Angular 10
while doing ng build --prod
. It works in ng build
.
ERROR in src/app/app.module.ts:44:5 - error NG6001: Cannot declare 'TimeAgoPipe' in an NgModule as it's not a part of the current compilation.
44 TimeAgoPipe,
~~~~~~~~~~~
node_modules/time-ago-pipe/time-ago.pipe.d.ts:3:22
3 export declare class TimeAgoPipe implements PipeTransform, OnDestroy {
~~~~~~~~~~~
'TimeAgoPipe' is declared here.
This is the file inside node_modules/time-ago-pipe/time-ago.pipe.d.ts
import { PipeTransform, NgZone, ChangeDetectorRef, OnDestroy } from "@angular/core";
import * as ɵngcc0 from '@angular/core';
export declare class TimeAgoPipe implements PipeTransform, OnDestroy {
private changeDetectorRef;
private ngZone;
private timer;
constructor(changeDetectorRef: ChangeDetectorRef, ngZone: NgZone);
transform(value: string): string;
ngOnDestroy(): void;
private removeTimer();
private getSecondsUntilUpdate(seconds);
static ɵfac: ɵngcc0.ɵɵFactoryDef<TimeAgoPipe, never>;
static ɵpipe: ɵngcc0.ɵɵPipeDefWithMeta<TimeAgoPipe, "timeAgo">;
}
//# sourceMappingURL=time-ago.pipe.d.ts.map
This is how I am using this in app.module.ts
file
import { NgModule } from '@angular/core';
import {TimeAgoPipe} from 'time-ago-pipe';
@NgModule({
declarations: [
TimeAgoPipe
],
imports: [
FormsModule,
],
entryComponents: [LastseenDevicesComponent],
bootstrap: [ AppComponent ],
})
export class AppModule { }
How can I fix this ?