angular-university / ngrx-course-v4

Contains the NgRx Store and Reactive Extensions Course
https://angular-university.io
150 stars 119 forks source link

Webpack Compilation Error - Function calls are not supported #8

Open hopkinsjj9 opened 7 years ago

hopkinsjj9 commented 7 years ago

I've tried uninstalling/reinstalling ngrx/core and angularfire2 without success.

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 C:/Users/Jack/Documents/ang2/ngrx-course-master/node_modules/@ngrx/core/compose.d.ts, resolving symbol reducer in C:/Users/Jack/Documents/ang2/ngrx-course-master/src/app/reducer.ts, resolving symbol reducer in C:/Users/Jack/Documents/ang2/ngrx-course-master/src/app/reducer.ts, resolving symbol reducer in C:/Users/Jack/Documents/ang2/ngrx-course-master/src/app/reducer.ts, resolving symbol AppModule in C:/Users/Jack/Documents/ang2/ngrx-course-master/src/app/app.module.ts, resolving symbol AppModule in C:/Users/Jack/Documents/ang2/ngrx-course-master/src/app/app.module.ts, resolving symbol AppModule in C:/Users/Jack/Documents/ang2/ngrx-course-master/src/app/app.module.ts webpack: Failed to compile.

angular/cli: 1.0.0 node: 8.0.0 os: win32 x64 angular/common: 4.2.4 angular/compiler: 4.2.4 angular/core: 4.2.4 angular/forms: 4.2.4 angular/http: 4.2.4 angular/platform-browser: 4.2.4 angular/platform-browser-dynamic: 4.2.4 angular/router: 4.2.4 angular/cli: 1.0.0 angular/compiler-cli: 4.2.4

hopkinsjj9 commented 7 years ago

I was able to backout the compose/store-freeze functionality in reducer.ts and compiled successfully.

//import {compose} from "@ngrx/core/compose"; //import {storeFreeze} from "ngrx-store-freeze"; ....

export const reducer = combineReducers({uiState,storeData, router: routerReducer});

Obviously, that's not the real solution. How can we get this functionality to work?

hopkinsjj9 commented 7 years ago

Without changing any code a recompile failed. This time on combineReducers. (see above) No idea what's going on here

Alucardz commented 7 years ago

In src\app\reducer.ts

Try replacing:

//old code
//export const reducer = compose(storeFreeze, combineReducers)({uiState,storeData, router: routerReducer});

//new code
export function reducer(state, action) {
    return compose(storeFreeze, combineReducers)({ uiState, storeData, router: routerReducer })(state, action);
}
hopkinsjj9 commented 7 years ago

Many thanks Alucardz. I will try using your suggestion. Hopefully, I can get the compose/store-freeze functionality working.