Skip to content

Commit

Permalink
[native] Fix Babel preset patch after React Native 0.70.15 upgrade
Browse files Browse the repository at this point in the history
Summary:
This addresses [ENG-9678](https://linear.app/comm/issue/ENG-9687/ens-names-not-resolving-on-ios-build-426), which tracks a regression caused by D13700.

Before that diff, we had just one version of `metro-react-native-babel-transformer` shared by Expo and React Native. After the diff, we have two versions:

- The old `[email protected]`, used by Expo, and patched [here](https://phab.comm.dev/D13702?vs=45132&id=45180#toc).
- The new `[email protected]`. It's in two places: as a transitive dependency of `metro` and a transitive dependency of `metro-react-native-babel-transformer`.

Because we now have two versions, the old patch only applies to one version, and the issue addressed by the patch was reintroduced.

I did some testing and found that of the three locations, we need two of them for the issue to be addressed: the old location, and one of the new locations, which is patched here. For some reason, the transitive dependency of `metro` itself does not appear to need to be patched.

Test Plan: I compiled release builds to my iOS simulator and physical Android device. I logged in as my "ashoat" user to production and confirmed I was able to resolve both normal "onchain" ENS names like "ashoat.eth" as well as "offchain" ENS names like "ashoat.base.eth".

Reviewers: will, varun

Reviewed By: will

Subscribers: tomek

Differential Revision: https://phab.comm.dev/D13748
  • Loading branch information
Ashoat committed Oct 17, 2024
1 parent fbaa1e1 commit 7d56562
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
diff --git a/node_modules/metro-react-native-babel-transformer/node_modules/metro-react-native-babel-preset/src/configs/main.js b/node_modules/metro-react-native-babel-transformer/node_modules/metro-react-native-babel-preset/src/configs/main.js
index 7ffbc92..912903d 100644
--- a/node_modules/metro-react-native-babel-transformer/node_modules/metro-react-native-babel-preset/src/configs/main.js
+++ b/node_modules/metro-react-native-babel-transformer/node_modules/metro-react-native-babel-preset/src/configs/main.js
@@ -136,12 +136,6 @@ const getPreset = (src, options) => {
extraPlugins.push([require("@babel/plugin-transform-async-to-generator")]);
}

- if (!isHermes && (isNull || src.indexOf("**") !== -1)) {
- extraPlugins.push([
- require("@babel/plugin-transform-exponentiation-operator"),
- ]);
- }
-
if (
isNull ||
src.indexOf("React.createClass") !== -1 ||

0 comments on commit 7d56562

Please sign in to comment.