Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apply Babel arrow transform only when needed (#41253)
Summary: Hermes supports arrows. I assume the only reason the transform wasn't dropped is due to the scary TODO. Originally, the arrow transform was conditional like this: ```js if (isNull || src.indexOf('=>') !== -1) { extraPlugins.push(es2015ArrowFunctions); } ``` I made it unconditional in facebook/metro@beb3d1a (D15947985) to work around an issue where React Refresh Babel plugin emitted arrow functions. However, I fixed that plugin to _not_ emit arrow functions a long time ago in facebook/react#15956. So this TODO is effectively solved, and has been, for ages. In this commit, we: - Skip the transform for Hermes altogether - For non-Hermes, revert to the old conditional behavior Possible alternatives: - We could skip it for Hermes but apply unconditionally otherwise (a bit simpler) - Or, if all target non-Hermes runtimes already support it natively, we could completely remove it ## Changelog: [GENERAL] [CHANGED] - Apply Babel arrow transform only on non-Hermes Pull Request resolved: #41253 Test Plan: Run fbsource tests (that's for you, not for me :) Reviewed By: NickGerleman Differential Revision: D50818568 Pulled By: robhogan fbshipit-source-id: ad96540bb7778792d38a6ddec06999d2acf620d0
- Loading branch information