Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure LogBox is not included in production bundles #28984

Closed
wants to merge 1 commit into from

Conversation

janicduplessis
Copy link
Contributor

Summary

I was doing some bundle inspection and noticed the LogBox module was included. It does amount to around 15kb so I think it is worth making sure it is not there.

To fix it I moved some imports to require inside DEV blocks to make sure metro is able to remove these imports.

Changelog

[General] [Fixed] - Make sure LogBox is not included in production bundles

Test Plan

Tested using react-native-bundle-visualizer and made sure nothing from LogBox was included in the bundle after these changes.

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Contributor A React Native contributor. labels May 26, 2020
@analysis-bot
Copy link

analysis-bot commented May 26, 2020

Platform Engine Arch Size (bytes) Diff
ios - universal 809,568 -9,937,520

Base commit: 68c0edd

@analysis-bot
Copy link

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 6,772,717 -8,001
android hermes armeabi-v7a 6,434,959 -8,009
android hermes x86 7,157,818 -8,016
android hermes x86_64 7,048,507 -8,014
android jsc arm64-v8a 8,946,255 -2,248
android jsc armeabi-v7a 8,600,897 -2,253
android jsc x86 8,774,512 -2,246
android jsc x86_64 9,350,812 -2,231

Base commit: 68c0edd

@@ -12,8 +12,6 @@

import Platform from '../Utilities/Platform';
import RCTLog from '../Utilities/RCTLog';
import * as LogBoxData from './Data/LogBoxData';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be handled by the inline requires feature. We don't like manually inlining requires if we can avoid it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sadly this is not enabled by default in OSS so I think doing it manually in this case is fine since it is not only for perf improvements.

Copy link
Member

@rickhanlonii rickhanlonii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks!

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rickhanlonii has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@react-native-bot
Copy link
Collaborator

This pull request was successfully merged by @janicduplessis in d3b937f.

When will my fix make it into a release? | Upcoming Releases

@react-native-bot react-native-bot added the Merged This PR has been merged. label Jun 3, 2020
@janicduplessis janicduplessis deleted the logbox-prod branch June 3, 2020 01:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Contributor A React Native contributor. Merged This PR has been merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants