Skip to content

Commit 0004888

Browse files
ecreethfacebook-github-bot
authored andcommitted
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: #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
1 parent cd78e39 commit 0004888

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

packages/react-native/Libraries/ReactNative/AppContainer.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,16 @@ class AppContainer extends React.Component<Props, State> {
5252
static getDerivedStateFromError: any = undefined;
5353

5454
mountReactDevToolsOverlays(): void {
55-
const DevtoolsOverlay = require('../Inspector/DevtoolsOverlay').default;
56-
const devtoolsOverlay = <DevtoolsOverlay inspectedView={this._mainRef} />;
55+
if (__DEV__) {
56+
const DevtoolsOverlay = require('../Inspector/DevtoolsOverlay').default;
57+
const devtoolsOverlay = <DevtoolsOverlay inspectedView={this._mainRef} />;
5758

58-
const TraceUpdateOverlay =
59-
require('../Components/TraceUpdateOverlay/TraceUpdateOverlay').default;
60-
const traceUpdateOverlay = <TraceUpdateOverlay />;
59+
const TraceUpdateOverlay =
60+
require('../Components/TraceUpdateOverlay/TraceUpdateOverlay').default;
61+
const traceUpdateOverlay = <TraceUpdateOverlay />;
6162

62-
this.setState({devtoolsOverlay, traceUpdateOverlay});
63+
this.setState({devtoolsOverlay, traceUpdateOverlay});
64+
}
6365
}
6466

6567
componentDidMount(): void {

0 commit comments

Comments
 (0)