Disable chrome react DevTools for production

前端 未结 5 659
[愿得一人]
[愿得一人] 2020-12-09 10:06

I\'m trying to browserify my react app for production using gulp and envify to setup NODE_ENV. So I can remove react warning, error reporting in the console, and even my cod

5条回答
  •  -上瘾入骨i
    2020-12-09 10:31

    If you are using redux-devtools-extension you can do this.

    const devTools =
      process.env.NODE_ENV === "production"
        ? applyMiddleware(...middlewares)
        : composeWithDevTools(applyMiddleware(...middlewares));
    
    const store = createStore(rootReducer, initialState, devTools);
    

    This will make sure your devtools extension only works in the development environment and not in the production environment

提交回复
热议问题