text: import { createStore, compose, applyMiddleware } from 'redux';
  import reduxImmutableStateInvariant from 'redux-immutable-state-invariant';
  import thunk from 'redux-thunk';
  import { routerMiddleware } from 'react-router-redux';
  
  import rootReducer from '../reducers';
  
  
  function configureStoreProd(initialState, history) {
    const historyMw = routerMiddleware(history);
  
    const middlewares = [
      historyMw,
      thunk,
    ];
  
    return createStore(rootReducer, initialState, compose(
      applyMiddleware(...middlewares)
      )
    );
  }
  
  function configureStoreDev(initialState, history) {
    const historyMw = routerMiddleware(history);
  
    const middlewares = [
      historyMw,
      reduxImmutableStateInvariant(),
      thunk,
    ];
  
    const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
    const store = createStore(rootReducer, initialState, composeEnhancers(
      applyMiddleware(...middlewares)
      )
    );
  
    if (module.hot) {
      module.hot.accept('../reducers', () => {
        const nextReducer = require('../reducers').default; // eslint-disable-line global-require
        store.replaceReducer(nextReducer);
      });
    }
  
    return store;
  }
  
  const configureStore = process.env.NODE_ENV === 'production' ? configureStoreProd : configureStoreDev;
  
  export default configureStore;
  