text: // @flow
  
  // #region imports
  import { createStore, applyMiddleware } from 'redux';
  import { createLogger } from 'redux-logger';
  import { routerMiddleware } from 'react-router-redux';
  import { composeWithDevTools } from 'redux-devtools-extension';
  // #region import createHistory from hashHistory or BrowserHistory:
  // import createHistory from 'history/createHashHistory';
  import createHistory from 'history/createBrowserHistory';
  // #endregion
  import thunkMiddleware from 'redux-thunk';
  import reducer from '../modules/reducers';
  import fetchMiddleware from '../middleware/fetchMiddleware';
  // #endregion
  
  // #region constants
  export const history = createHistory();
  // #endregion
  
  // #region createStore : enhancer
  
  // #region logger middleware (dev only)
  const loggerMiddleware = createLogger({
    level: 'info',
    collapsed: true,
  });
  // #endregion
  
  const enhancer = composeWithDevTools(
    applyMiddleware(
      thunkMiddleware,
      routerMiddleware(history),
      fetchMiddleware,
      loggerMiddleware, // logger at the end
    ),
  );
  // #endregion
  
  export default function configureStore(initialState) {
    const store = createStore(reducer, initialState, enhancer);
    if (module.hot) {
      module.hot.accept('../modules/reducers', () =>
        store.replaceReducer(require('../modules/reducers').default),
      );
    }
    return store;
  }
  