-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Conversation
Base commit: 68c0edd |
Base commit: 68c0edd |
@@ -12,8 +12,6 @@ | |||
|
|||
import Platform from '../Utilities/Platform'; | |||
import RCTLog from '../Utilities/RCTLog'; | |||
import * as LogBoxData from './Data/LogBoxData'; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks!
There was a problem hiding this 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.
This pull request was successfully merged by @janicduplessis in d3b937f. When will my fix make it into a release? | Upcoming Releases |
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.