text: import { createStore as _createStore, applyMiddleware, compose } from 'redux';
  import createMiddleware from './middleware/clientMiddleware';
  import { syncHistoryWithStore } from 'react-router-redux';
  import { routerMiddleware} from 'react-router-redux';
  import { browserHistory } from 'react-router';
  
  export default function createStore(history, client, data) {
    const middleware = [createMiddleware(client)];
  
    let finalCreateStore;
    if (__DEVELOPMENT__ && __CLIENT__ && __DEVTOOLS__) {
      const { persistState } = require('redux-devtools');
      const DevTools = require('../containers/DevTools/DevTools');
      finalCreateStore = compose(
        applyMiddleware(...middleware),
        applyMiddleware(routerMiddleware(browserHistory)),
        window.devToolsExtension ? window.devToolsExtension() : DevTools.instrument(),
        persistState(window.location.href.match(/[?&]debug_session=([^&]+)\b/))
      )(_createStore);
    } else {
      finalCreateStore = compose(
        applyMiddleware(...middleware),
        applyMiddleware(routerMiddleware(browserHistory)),
      )(_createStore);
    }
  
    const reducer = require('./modules/reducer');
    const store = finalCreateStore(reducer, data);
  
    const _history = syncHistoryWithStore(history, store);
  
    if (__DEVELOPMENT__ && module.hot) {
      module.hot.accept('./modules/reducer', () => {
        store.replaceReducer(require('./modules/reducer'));
      });
    }
  
    return store;
  }
  