angular2 ngrx,部署到github-pages时出错

时间:2017-02-17 20:11:39

标签: angular deployment github-pages ngrx

我在我的angular2项目中添加了reducers:

const rootReducer = compose(storeLogger(), combineReducers)({
  toolbar: toolbarReducer
});

  imports: [
    ...,
    StoreModule.provideStore(rootReducer)
  ],

它正常工作,但当我尝试将其部署到github-pages

ng github-pages:deploy

然后我最终得到以下错误:

ERROR in 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 12:42 in the original .ts file), resolving symbol compose in /Users/gkucmierz/learn/coin-tools/node_modules/@ngrx/core/compose.d.ts, resolving symbol AppModule in /Users/gkucmierz/learn/coin-tools/src/app/app.module.ts, resolving symbol AppModule in /Users/gkucmierz/learn/coin-tools/src/app/app.module.ts, resolving symbol AppModule in /Users/gkucmierz/learn/coin-tools/src/app/app.module.ts, resolving symbol AppModule in /Users/gkucmierz/learn/coin-tools/src/app/app.module.ts, resolving symbol AppModule in /Users/gkucmierz/learn/coin-tools/src/app/app.module.ts

我做错了什么?

1 个答案:

答案 0 :(得分:1)

错误信息非常清楚 您必须为AoT静态分析您的代码。

见这里: https://medium.com/@isaacplmann/making-your-angular-2-library-statically-analyzable-for-aot-e1c6f3ebedd5#.3ipjxwp1z

此错误与github页面无关。

这将以JIT模式构建您的代码:ng build
这在AOT模式下:ng build --aot
github-pages:deploy命令正在进行AOT构建。