How to use redux-devtools only in a development environment

I only want to use redux-devtools-extension and redux-logger in the development environment, so I created two store , and then made a judgment, but after packaging, I found that this judgment did not work, redux-devtools-extension can always be loaded in the production environment.

when I use create-react-app, I wrote console.log (process.env.NODE_ENV) in render; found that the environment variable in the production environment is indeed production, but why did this happen? has anyone ever encountered it?

if (process.env.NODE_ENV === "production") {
  store = devStore;
} else {
  store = prodStore;
}
Mar.19,2022

use redux-devtools-extension//logOnlyInProduction

https://github.com/zalmoxisus.

Menu