text: import {createStore, compose, applyMiddleware} from 'redux';
  import createLogger from 'redux-logger';
  import reduxImmutableStateInvariant from 'redux-immutable-state-invariant';
  import rootReducer from '../reducers';
  import createSagaMiddleweare , {END} from 'redux-saga';
  import rootSaga from '../Saga';
  
  const loggerMiddleWare  = createLogger();
  const sagaMiddleweare = createSagaMiddleweare();
  function configureStoreProd(initialState) {
    const middlewares = [
      // Add other middleware on this line...
        sagaMiddleweare,
      // thunk middleware can also accept an extra argument to be passed to each thunk action
      // https://github.com/gaearon/redux-thunk#injecting-a-custom-argument
  
    ];
  
   const store = createStore(rootReducer, initialState, compose(
      applyMiddleware(...middlewares)
      )
    );
  
    sagaMiddleweare.run(rootSaga);
    store.close = () => store.dispatch(END);
    return store;
  }
  
  function configureStoreDev(initialState) {
    const middlewares = [
      // Add other middleware on this line...
      sagaMiddleweare,
      // Redux middleware that spits an error on you when you try to mutate your state either inside a dispatch or between dispatches.
      reduxImmutableStateInvariant(),
  
  
  
      loggerMiddleWare,
  
    ];
  
    const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose; // add support for Redux dev tools
    const store = createStore(rootReducer, initialState, composeEnhancers(
      applyMiddleware(...middlewares)
      )
    );
  
    if (module.hot) {
      // Enable Webpack hot module replacement for reducers
      module.hot.accept('../reducers', () => {
        const nextReducer = require('../reducers').default; // eslint-disable-line global-require
        store.replaceReducer(nextReducer);
      });
    }
    sagaMiddleweare.run(rootSaga);
    store.close = () => store.dispatch(END);
    return store;
  }
  
  const configureStore = process.env.NODE_ENV === 'production' ? configureStoreProd : configureStoreDev;
  
  export default configureStore;