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

fix: add babel plugins to support Hermes #617

Merged
merged 2 commits into from
Aug 1, 2019

Conversation

tido64
Copy link
Contributor

@tido64 tido64 commented Aug 1, 2019

Hermes doesn't understand ES6 (yet?) so we need the following babel plugins to support it.

Summary

These plugins, and their options, were lifted from metro-react-native-babel-preset. I'm not 100% whether this is exhaustive (as metro includes a lot more) but it works for us in a fairly large code base.

Test plan

All tests should still pass.

@tido64
Copy link
Contributor Author

tido64 commented Aug 1, 2019

cc @acoates-ms, @thymikee, @zamotany

@zamotany
Copy link
Contributor

zamotany commented Aug 1, 2019

@tido64 How about we add those transforms or modify options only when hermes: true flag is passed to Babel preset:

module.exports = {
  presets: ['module:@haul-bundler/babel-preset-react-native', { hermes: true }],
};

making if effectively opt-in?

Enabling those transforms will increate the bundle size by a significant margin, which we wanted to avoid with @haul-bundler/babel-preset-react-native. If we enable them by default, out babel preset will effectively be a clone of metro-react-native-babel-preset, in which case folks can just use Metro's preset.

@zamotany zamotany merged commit 6af4e04 into callstack:master Aug 1, 2019
@zamotany
Copy link
Contributor

zamotany commented Aug 1, 2019

Thanks @tido64 for this contribution. I'll do a release today EOD.

@tido64
Copy link
Contributor Author

tido64 commented Aug 1, 2019

@zamotany Thanks for the quick response! <3

@tido64 tido64 deleted the tido/hermes-support branch August 1, 2019 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants