text: import { applyMiddleware, compose, createStore } from 'redux'
  import thunk from 'redux-thunk'
  import rootReducer from '../reducers'
  
  export default (initialState = {}) => {
    // ======================================================
    // Middleware Configuration
    // ======================================================
    const middleware = [thunk]
  
    // ======================================================
    // Store Enhancers
    // ======================================================
    const enhancers = []
    if (__DEBUG__) {
      const devToolsExtension = window.devToolsExtension
      if (typeof devToolsExtension === 'function') {
        enhancers.push(devToolsExtension())
      }
    }
  
    // ======================================================
    // Store Instantiation and HMR Setup
    // ======================================================
    const store = createStore(
      rootReducer,
      initialState,
      compose(
        applyMiddleware(...middleware),
        ...enhancers
      )
    )
  
    if (module.hot) {
      module.hot.accept('../reducers', () => {
        store.replaceReducer(rootReducer)
      })
    }
  
    return store
  }
  