Don't compile Hermes-supported features with Babel #1773
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This simplifies the generated code to be closer to the code we actually write.
Concretely:
We will be able to remove both of these overrides when we upgrade Expo:
However, I don't know when we'll get to updating, so why not fix this now.
Test plan
Walked around the app. App seems to work. Equivalent changes being in newer Expo releases give some confidence.
Bundle output changes
Glance over the bundle diff.
Function names are now implied (since Hermes can do this):
Native support for
??
and?.
and friends:No runtime code needed for rest/spread:
Also, we finally get rid of this
_objectSpread
helper:Fun fact: this
_objectSpread
helper was duplicated in our bundle almostthree thousand times500 times (with 3000 call sites).Total minified PROD bundle went down from 8.9 MB to 8.6 MB.
Spreads in particular are very common so having them go through fewer indirections is nice.