Error building angular+ngrx 8 for production when using createReducer function Error building angular+ngrx 8 for production when using createReducer function angular angular

Error building angular+ngrx 8 for production when using createReducer function


You need to wrap your reducer as function call like this:

const yourReducer = createReducer(  initialState,  on(RequestsActions.loadRequestsSuccess, (state, { requests }) => adapter.addAll(requests, {...state, loading: false})),  on(RequestsActions.loadRequestsFailed, (state, { error }) => ({...state, error, loading: false})),  on(RequestsActions.deleteRequestSuccess, (state, { id }) => adapter.removeOne(id, state)));export function reducer(state: State | undefined, action: Action) {  return yourReducer(state, action);}

See the official doc -

https://ngrx.io/guide/store/reducers#creating-the-reducer-function