尝试启动npm时出错:
Error encountered resolving symbol values statically. Function calls are not supported. Consider replacing the function or lambda
引用导出的函数(位置47:19 在原始.ts文件中),解析符号 D中的CoreModule:/Projects/UI3/src/app/core/core.module.ts
核心是:
providers: [
{provide: HttpService,
useFactory: (backend: XHRBackend, options: RequestOptions) => { // Here 47 line number
return new HttpService(backend, options);
},
deps: [XHRBackend, RequestOptions]},
AuthenticationService,
DialogsService,
AuthenticationGuard,
I18nService
]
所以,它以前有用过。
答案 0 :(得分:4)
您需要提取箭头功能,如:
export function httpServiceFactory(backend: XHRBackend, options: RequestOptions) {
return new HttpService(backend, options);
}
...
@NgModule({
...
providers: [
{
provide: HttpService,
useFactory: httpServiceFactory,
deps: [XHRBackend, RequestOptions]
},
AuthenticationService,
DialogsService,
AuthenticationGuard,
I18nService
]
另见