text: /**
   * Create the store with asynchronously loaded reducers
   */
  
  import { createStore, applyMiddleware, compose } from 'redux';
  import { routerMiddleware } from 'react-router-redux';
  import { browserHistory } from 'react-router';
  import createSagaMiddleware from 'redux-saga';
  
  import globalSagas from 'common/sagas';
  import createReducer from './reducers';
  
  
  const sagaMiddleware = createSagaMiddleware();
  const devtools = window.devToolsExtension || (() => noop => noop);
  
  export default function configureStore (initialState = {}) {
    // Create the store with two middlewares
    // 1. sagaMiddleware: Makes redux-sagas work
    // 2. routerMiddleware: Syncs the location/URL path to the state
    const middlewares = [
      routerMiddleware(browserHistory),
      sagaMiddleware,
    ];
  
    const enhancers = [
      applyMiddleware(...middlewares),
      devtools(),
    ];
  
    const store = createStore(
      createReducer(),
      initialState,
      compose(...enhancers)
    );
  
    // We run the root saga automatically
    sagaMiddleware.run(...globalSagas);
    // Create hook for async sagas
    store.runSaga = sagaMiddleware.run;
    store.asyncReducers = {}; // Async reducer registry
  
    // Make reducers hot reloadable, see http://mxs.is/googmo
    /* istanbul ignore next */
    if (module.hot) {
      System.import('./reducers').then((reducerModule) => {
        const createReducers = reducerModule.default;
        const nextReducers = createReducers(store.asyncReducers);
  
        store.replaceReducer(nextReducers);
      });
    }
  
    return store;
  }
  