"Expected the reducer to be a function"

Author: RomansWorksCreated Apr 3, 2016Updated Oct 19, 2021

When running with npm run dev and loading the first page, I got:

[1] Error: Expected the reducer to be a function.
[1]     at createStore (/somedir/node_modules/redux/lib/createStore.js:63:11)
[1]     at /somedir/node_modules/redux/lib/applyMiddleware.js:37:19
[1]     at createStore (create.js:25:17)
[1]     at server.js:71:17
[1]     at Layer.handle [as handle_request] (/somedir/node_modules/express/lib/router/layer.js:95:5)
[1]     at trim_prefix (/somedir/node_modules/express/lib/router/index.js:312:13)
[1]     at /somedir/node_modules/express/lib/router/index.js:280:7
[1]     at Function.process_params (/somedir/node_modules/express/lib/router/index.js:330:12)
[1]     at next (/somedir/node_modules/express/lib/router/index.js:271:10)
[1]     at SendStream.error (/somedir/node_modules/serve-static/index.js:120:7)

This seems to be due to CommonJS require method in src/redux/create.js returning an object instead of the ES6 import's function:

const reducer = import reducer from './modules/reducer';

Instead, this fixed it for me:

import reducer from './modules/reducer'; 

Are there any unwanted side effects with this change? Should I issues a pull request?

Thanks

Source: erikras/react-redux-universal-hot-example