Hermes transforms not enabled by default when creating a new 0.70.0 project
See original GitHub issueDescription
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
System:
OS: macOS 12.5.1
CPU: (8) arm64 Apple M1
Memory: 112.94 MB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 18.7.0 - /opt/homebrew/bin/node
Yarn: 1.22.15 - /usr/local/bin/yarn
npm: 8.15.0 - /opt/homebrew/bin/npm
Watchman: 2022.07.04.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
Android SDK: Not Found
IDEs:
Android Studio: 2021.2 AI-212.5712.43.2112.8512546
Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
Languages:
Java: 11.0.15 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.1.0 => 18.1.0
react-native: 0.70.0 => 0.70.0
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
Steps to reproduce
- Create a new project
npx react-native@0.70.0 init ExampleApp cd ExampleApp
- Add the following code to
App.js
console.log(2n ** 42n);
- Start the project
yarn android
Observe that the app crashes with:
ERROR TypeError: Cannot convert BigInt to number
This is because the project is using the non Hermes transforms that convert the code you added to this invalid code:
Math.pow(2n, 42n); // You can't use `Math.pow` with `BigInt`!
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:
module.exports = {
presets: [
[
'module:metro-react-native-babel-preset',
{unstable_transformProfile: 'hermes-stable'},
],
],
};
Snack, code example, screenshot, or link to a repository
Issue Analytics
- State:
- Created a year ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
React Native (Android) - Failed to transform hermes-debug.aar
1. After using command npx react-native upgrade , there are changes in number version of dependencies. I also edit build.gradle in ...
Read more >Announcing React Native 0.70
We are excited to release a new version of React Native, 0.70.0. ... first version with Hermes, our in-house JS engine, enabled by...
Read more >react-native | Yarn - Package Manager
Changelog. v0.69.1. Changed. iOS specific. Make all Yoga headers public and add #ifdef __cplusplus (43f831b23c by @janicduplessis) ...
Read more >error failed to load configuration of your project. info run cli with
"Xcode no longer creates every available iOS simulator device by default. ... The issue can be reproduced using yarn or npm on a...
Read more >Using Hermes in React Native - LogRocket Blog
Hermes is not just good for React Native applications, but contributes a ... To create a new React Native project, navigate to your...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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 (
a ** b
→Math.pow(a, b)
) frommetro-react-native-babel-preset
altogether, given that both JSC and Hermes support this syntax natively. This will likely depend on https://github.com/facebook/metro/pull/871, which will be part of the next Metro version.@kelset is there any update or another issue we should track?