Allow disabling React DevTools using a new environment variable

0
open
bobaekang
bobaekang
Posted 1 month ago

Allow disabling React DevTools using a new environment variable #11551

Is your proposal related to a problem?

Currently, CRA apps do not have any way to fully disable React DevTools via an existing, webpack configuration-based solution (https://github.com/facebook/react/pull/11448) and must resort to a more hacky solution such as the ones found here: https://github.com/facebook/react-devtools/issues/191.

While it is possible to configure Webpack after ejecting, that seems too costly a solution for a simple change like this.

Describe the solution you'd like

Add a new boolean environment variable DISABLE_DEVTOOLS or DISABLE_REACT_DEVTOOLS to the advanced configuration list so that the webpack configuration based solution can be available without ejecting. The default value for this new environment variable may be set to false to match the current behavior.

Describe alternatives you've considered

As mentioned above, one existing alternative is to eject and directly configure webpack setting. But this seems not desirable/too costly for a simple change like this. Another is to use the aforementioned hacky solution.

Additional context

(Write your answer here.)