import * as Redux from 'redux'

import Hermes from '~/../utils/hermes'
import {rootReducer, rootReducerMock} from '~/frontend/redux/reducers'

declare global {
  interface Window {
    __REDUX_DEVTOOLS_EXTENSION__: Function
  }
}

const useMock = false // Should only be true for development
const logger = new Hermes({name: 'frontend'})

const configureStore = (): Redux.Store<any> => {
  const devtools = window.__REDUX_DEVTOOLS_EXTENSION__
  const _m = module as any

  if (_m.hot && useMock) {
    logger.info('Loading rootReducerMock')
    const store = Redux.createStore(rootReducerMock, devtools && devtools())
    _m.hot.accept('./reducers', () => store.replaceReducer(require('./reducers')))
    return store
  }

  const store = Redux.createStore(rootReducer, devtools && devtools())
  return store
}

const store = configureStore()

export default store

import * as Redux from 'redux'

import Hermes from '~/../utils/hermes'
import {rootReducer, rootReducerMock} from '~/frontend/redux/reducers'

declare global {
  interface Window {
    __REDUX_DEVTOOLS_EXTENSION__: Function
  }
}

const logger = new Hermes({name: 'frontend'})

const configureStore = (): Redux.Store<any> => {
  const devtools = window.__REDUX_DEVTOOLS_EXTENSION__
  const _m = module as any

  if (_m.hot) {
    logger.info('Loading rootReducerMock')
    const store = Redux.createStore(rootReducerMock, devtools && devtools())
    _m.hot.accept('./reducers', () => store.replaceReducer(require('./reducers')))
    return store
  }

  const store = Redux.createStore(rootReducer, devtools && devtools())
  return store
}

const store = configureStore()

export default store

--- 
+++ 
@@ -9,13 +9,14 @@
   }
 }
 
+const useMock = false // Should only be true for development
 const logger = new Hermes({name: 'frontend'})
 
 const configureStore = (): Redux.Store<any> => {
   const devtools = window.__REDUX_DEVTOOLS_EXTENSION__
   const _m = module as any
 
-  if (_m.hot) {
+  if (_m.hot && useMock) {
     logger.info('Loading rootReducerMock')
     const store = Redux.createStore(rootReducerMock, devtools && devtools())
     _m.hot.accept('./reducers', () => store.replaceReducer(require('./reducers')))
Use mock reducer only when useMock=true
