问题描述
您好,人们在这里发现了很多类似的问题,但没有找到适合我的解决方案(
我正在为角度开发库,并在其中使用ngRx存储。当我尝试使用命令ng build lib --prod
构建库时,出现错误
ERROR: Error during template compile of 'CarolLblibmodule'
Function calls are not supported in decorators but 'StoreModule' was called.
An unhandled exception occurred: Error during template compile of 'CarolLblibmodule'
Function calls are not supported in decorators but 'StoreModule' was called.
@NgModule({
declarations: [
],imports: [
PagesModule,StoreModule.forFeature(
lbFeatureKey,LB_REDUCER_TOKEN
),EffectsModule.forFeature([GlobalBoardEffects])
],exports: [
],providers: [
{provide: LB_REDUCER_TOKEN,useFactory: getReducers}
]
})
LB_REDUCER_TOKEN和getReducers
看起来像
export const LB_REDUCER_TOKEN = new InjectionToken<ActionReducerMap<leaderboardState>>('leaderboard reducers');
export function getReducers(): ActionReducerMap<leaderboardState> {
// map of reducers
return {
[globalBoardReducer.globalBoardFeatureKey]: globalBoardReducer.reducer,};
}
以防万一我的Globalboard reducers代码很重要
const globalReducer = createReducer(
initialGlobalBoardState,on(GlobalBoardActions.SetData,(state: GlobalBoardState,{leaders}) => ({...state,data: [...leaders]})
),);
// tslint:disable-next-line:typedef
export function reducer(state: GlobalBoardState | undefined,action: Action) {
return globalReducer(state,action);
}
所以我不明白是什么问题?有什么建议吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)