facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
118.6k stars 24.28k forks source link

Hermes transforms (unstable_transformProfile: 'hermes-stable') prevents from archiving the project in Xcode #34663

Closed jcoulaud closed 2 years ago

jcoulaud commented 2 years ago

Description

Since August, Hermes JavaScript engine is enabled by default on brand new projects but not the Hermes code transforms. So, to work with BigInt and not have the following error

bash ERROR  TypeError: Cannot convert BigInt to number

, I need to enable them in my babel.config.js as stated in the Solana guide:

  module.exports = {
-   presets: ['module:metro-react-native-babel-preset'],
+   presets: [
+     [
+       'module:metro-react-native-babel-preset',
+       {unstable_transformProfile: 'hermes-stable'},
+     ],
+   ],
};

But, doing that, I can't archive my project on Xcode anymore. I get this error while trying:

error: File /Users/julien/Library/Developer/Xcode/DerivedData/test-bwyhfbhfgywuwjdqadmluvempaqw/Build/Intermediates.noindex/ArchiveIntermediates/test/BuildProductsPath/Release-iphoneos/test.app/main.jsbundle does not exist. This must be a bug with React Native, please report it here: https://github.com/facebook/react-native/issues'

PS: There is also this other issue related to the same problem

Version

0.70.0

Output of npx react-native info

System:
    OS: macOS 12.5.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 1.47 GB / 32.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.16.0 - ~/.nvm/versions/node/v16.16.0/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 8.11.0 - ~/.nvm/versions/node/v16.16.0/bin/npm
    Watchman: 2022.09.05.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.8815526
    Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
  Languages:
    Java: Not Found
  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

  1. Create a new project

    npx react-native@0.70.0 init test
    cd test
  2. Add the following code to App.js

    console.log(2n ** 42n);
  3. Try to archive the project on Xcode

error: File /Users/julien/Library/Developer/Xcode/DerivedData/test-bwyhfbhfgywuwjdqadmluvempaqw/Build/Intermediates.noindex/ArchiveIntermediates/test/BuildProductsPath/Release-iphoneos/test.app/main.jsbundle does not exist. This must be a bug with React Native, please report it here: https://github.com/facebook/react-native/issues'

Snack, code example, screenshot, or link to a repository

https://snack.expo.dev/@jcoulaud/bigint-with-non-hermes-transform

kelset commented 2 years ago

duplicate of #34656