refactor: don't include DevtoolsOverlay & TraceUpdateOverlay in the production bundle (#40749)

Summary:
Currently, when we build the app in production mode the `DevtoolsOverlay` & `TraceUpdateOverlay` are bundle

## Changelog:

[GENERAL][REMOVED]: removed `DevtoolsOverlay` & `TraceUpdateOverlay` from production bundle

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests

Pull Request resolved: https://github.com/facebook/react-native/pull/40749

Test Plan:
1. Build the app in production mode
2. Check that both `DevtoolsOverlay` & `TraceUpdateOverlay` are included in the bundle

Reviewed By: robhogan, NickGerleman

Differential Revision: D50121208

Pulled By: hoxyq

fbshipit-source-id: 3e1fb506c679ec79b116dea9772d372cd2ea9ca9
This commit is contained in:
Luis Miguel Alvarado
2023-10-11 09:54:22 -07:00
committed by Facebook GitHub Bot
parent cd78e39e2b
commit 0004888608
@@ -52,14 +52,16 @@ class AppContainer extends React.Component<Props, State> {
static getDerivedStateFromError: any = undefined;
mountReactDevToolsOverlays(): void {
const DevtoolsOverlay = require('../Inspector/DevtoolsOverlay').default;
const devtoolsOverlay = <DevtoolsOverlay inspectedView={this._mainRef} />;
if (__DEV__) {
const DevtoolsOverlay = require('../Inspector/DevtoolsOverlay').default;
const devtoolsOverlay = <DevtoolsOverlay inspectedView={this._mainRef} />;
const TraceUpdateOverlay =
require('../Components/TraceUpdateOverlay/TraceUpdateOverlay').default;
const traceUpdateOverlay = <TraceUpdateOverlay />;
const TraceUpdateOverlay =
require('../Components/TraceUpdateOverlay/TraceUpdateOverlay').default;
const traceUpdateOverlay = <TraceUpdateOverlay />;
this.setState({devtoolsOverlay, traceUpdateOverlay});
this.setState({devtoolsOverlay, traceUpdateOverlay});
}
}
componentDidMount(): void {