尝试使用以下命令编译我的 RC6 应用程序时:
ngc -p C:\Path\To\Project
C:\Path\To\Project\node_modules\.bin
(当我运行命令时,我被放置在里面)
我收到以下错误:
Error encountered resolving symbol values statically. Function calls are not supported. Consider replacing the function or lambda with a reference to an exported function (position 20:25 in the original .ts file), resolving symbol CoreModule in C:/Path/To/Project/app/modules/core/core.module.ts
这就是它所抱怨的:
@NgModule({
imports: [
CommonModule,
TranslateModule.forRoot({
provide: TranslateLoader,
useFactory: (http: Http) => new TranslateStaticLoader(http, 'app/languages', '.json'),
deps: [Http]
})
],
如果我删除TranslateModule.forRoot...
错误消失。
正如错误所暗示的那样,如何用导出的函数替换它?