-
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
Hermes transforms not enabled by default when creating a new 0.70.0 project #34656
Comments
I agree, I have the same problem. However, if I add {unstable_transformProfile: 'hermes-stable'} to my babel config , I can't archive my project anymore with Xcode. Is it the same for you?
|
Can confirm that this repro generates the error - I'll be passing this on the Hermes team so that they can help. |
@kelset is there any update or another issue we should track? |
Yeah, interesting. I just tried this myself. The build step when you do
If I create a
… Essentially, |
Thanks for the valid workarounds! Forwarding some conversations from the team:
|
To add to @huntie's comment: Longer-term solutions aside, we're looking to unblock the use of BigInt by removing the exponentiation operator transform ( |
…form Summary: Context: `Math.pow(a, b)` throws when `a` or `b` is a BigInt, while `a ** b` evaluates to a BigInt in that case. This makes [`babel/plugin-transform-exponentiation-operator`](https://babeljs.io/docs/en/babel-plugin-transform-exponentiation-operator) unsafe in code that uses BigInts. See also facebook/react-native#34656, facebook/react-native#34603. Here we remove the plugin from the React Native Babel preset. This is safe to do because: 1. Hermes supports the `**` operator [natively](facebook/hermes@ae0bc93). 2. JSC on iOS has supported the `**` operator natively since version 10.3 (source: [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Exponentiation#browser_compatibility)), and React Native targets iOS 12.4+. 3. The version of JSC React Native uses on Android ([jsc-android@v250230.2.1](https://github.com/react-native-community/jsc-android-buildscripts/releases/tag/v250230.2.1)) is based on [WebKit commit 250230](https://commits.webkit.org/250230@main) which [supports](https://github.com/WebKit/WebKit/blob/1d27863e32855c7fe51d5de1aae0589f11a428be/Source/JavaScriptCore/features.json#L170-L185) the `**` operator. 4. Metro now uses Terser as the default minifier (#871) which includes support for modern language features such as the `**` operator. Changelog: * **[Fix]** Remove exponentiation operator transform from `metro-react-native-babel-preset`. NOTE: This is a fix and not a breaking change because `metro-react-native-babel-preset` is *already* meant for use only with current React Native versions, where the `**` operator is supported natively (as shown above). Reviewed By: huntie Differential Revision: D39683437 fbshipit-source-id: 67d84e7a9eecf27e40b7d7b9d4b3666a4201fec1
hey @motiz88 just to double-check, is it safe to say that this will be addressed in Metro 73 in RN71, by this commit facebook/metro@c2365bb ? |
The BigInt issue that @steveluscher was having will be fixed in the default config at that point, yes. There will be no change to the experimental, unsupported |
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
This issue was closed because it has been stalled for 7 days with no activity. |
Description
I can tell that the Hermes Babel transforms are not enabled in brand new 0.70.0 projects.
Version
0.70.0
Output of
npx react-native info
Steps to reproduce
App.js
Observe that the app crashes with:
This is because the project is using the non Hermes transforms that convert the code you added to this invalid code:
The workaround is to enable the transforms in
babel.config.js
, but it would be preferable if 0.70.0 did this by virtue of Hermes being enabled:Snack, code example, screenshot, or link to a repository
https://snack.expo.dev/haG_X4VvG
The text was updated successfully, but these errors were encountered: