Angular “auth”中的装饰器不支持函数表达式

Angular “auth”中的装饰器不支持函数表达式,angular,ngrx,Angular,Ngrx,我正在尝试使用aot构建angular 7项目,但aot抛出以下错误 ERROR in app/app.store.ts(10,25): Error during template compile of 'AppStoreModule' Function expressions are not supported in decorators in 'auth' 'auth' references 'auth' 'auth' contains the error at app/state/a

我正在尝试使用aot构建angular 7项目,但aot抛出以下错误

ERROR in app/app.store.ts(10,25): Error during template compile of 'AppStoreModule'

Function expressions are not supported in decorators in 'auth'
'auth' references 'auth'
  'auth' contains the error at app/state/auth/auth.reducers.ts(12,41)
    Consider changing the function expression into an exported function.
我已经检查了ngrx减速器的auth,如下所示

export const auth: ActionReducer<any> = (
  state = initialState,
  action: authActions
) => {
  switch (action.type) {
    case Auth.AUTH_REFRESH:
    case Auth.AUTH_LOGIN:
      console.log(" reducer called");
      return Object.assign({}, state);
    case Auth.AUTH_LOGIN_SUCCESS:
      console.log("login success reducer");
      let token = localStorage.getItem("token");
      const decodedToken = helper.decodeToken(token);
      console.log(decodedToken.sub);
      return Object.assign({}, state, {
        currentUser: decodedToken.sub,
        loggedIn: !helper.isTokenExpired(token)
      });

    default:
      return state;
  }
};

我不知道代码有什么问题。

这是AOT编译的常见问题,您需要将函数从箭头函数更改为前面提到的命名函数

@NgModule({
  imports: [
    StoreModule.forRoot({
      auth,
      app,
      search
    }),
    EffectsModule.forRoot([AuthEffects, AppEffects, SearchEffects])
  ]
})