库模块中的角度APP_INITIALIZER生成元数据编译时间错误

这是我的ng库模块代码

   @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
            }
          ]
        };
      }
    }

在构建中:

> 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}

如果我将APP_INITIALIZER提供程序移到应用程序模块中就可以了,但是我不希望应用程序具有此知识。

shwgy123 回答:库模块中的角度APP_INITIALIZER生成元数据编译时间错误

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3104085.html

大家都在问