This is my ng library module code
@NgModule({
imports: [NgIdleModule.forRoot()],
providers: [ {
provide: APP_INITIALIZER,
useFactory: (idleStateChangeHandlerService: IdleStateChangeHandlerService) => () => console.log(IdleStateChangeHandlerService),
multi: true,
deps: [IdleStateChangeHandlerService]
}]
})
export class IdleActivityModule {
static forRoot(config: IdleActivityConfig): ModuleWithProviders {
return {
ngModule: IdleActivityModule,
providers: [
{
provide: IdleActivityConfigInjectionToken,
useValue: config
}
]
};
}
}
On build:
> Compiling TypeScript sources through ngc ERROR:
> C:/_dev/seemis-workspace/projects/shared-modules/src/lib/idle-activity/idle-activity.module.ts:9:1:
> Error encountered in metadata generated for exported symbol
> 'IdleActivityModule':
> C:/_dev/seemis-workspace/projects/shared-modules/src/lib/idle-activity/idle-activity.module.ts:13:17:
> Metadata collected contains an error that will be reported at runtime:
> Lambda not supported. {"__symbolic":"error","message":"Lambda not
> supported","line":12,"character":16}
If I move APP_INITIALIZER
provider into the app module instead it is fine, but I don't want the app to have to have this knowledge.