-
Notifications
You must be signed in to change notification settings - Fork 24.5k
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
iOS Build with Hermes outputs an incorrect sourcemap file #34212
Labels
Comments
This shoudl be addressed by #34111 |
roryabraham
pushed a commit
to Expensify/react-native
that referenced
this issue
Aug 17, 2022
…#34111) Summary: ## Summary Fixes facebook#32497 Fixes facebook#34212 The assigned HBC_SOURCEMAP_FILE path is incorrect as it does not reference the hermes bundle source map file See: facebook#32497 (comment) ## Changelog [General] [Fixed] - using SOURCEMAP_FILE during xcode build phase with Hermes enabled Pull Request resolved: facebook#34111 Test Plan: 1. In a blank react-native project 1. Enable Hermes 1. Go to xCode -> Project -> Build Phases -> Bundle React Native code and images 3. Add `export SOURCEMAP_FILE="$(pwd)/../ios.jsbundle.map"` before `react-native-xcode.sh` e.g. ```sh export NODE_BINARY=node export SOURCEMAP_FILE="$(pwd)/../ios.jsbundle.map" ../node_modules/react-native/scripts/react-native-xcode.sh ``` 4. Make a release build `npx react-native run-ios --configuration Release` or `CMD + I` in xCode 5. Verify the build is successful 6. Verify the `.map` file is outputted at the specified path (`ios.jsbundle.map` in project root for the example above) Reviewed By: cipolleschi Differential Revision: D38460586 Pulled By: dmitryrykun fbshipit-source-id: 54c1594b37fa2253896ce9739c1a9a712deecd0f
roryabraham
pushed a commit
to Expensify/react-native
that referenced
this issue
Aug 17, 2022
…#34111) Summary: ## Summary Fixes facebook#32497 Fixes facebook#34212 The assigned HBC_SOURCEMAP_FILE path is incorrect as it does not reference the hermes bundle source map file See: facebook#32497 (comment) ## Changelog [General] [Fixed] - using SOURCEMAP_FILE during xcode build phase with Hermes enabled Pull Request resolved: facebook#34111 Test Plan: 1. In a blank react-native project 1. Enable Hermes 1. Go to xCode -> Project -> Build Phases -> Bundle React Native code and images 3. Add `export SOURCEMAP_FILE="$(pwd)/../ios.jsbundle.map"` before `react-native-xcode.sh` e.g. ```sh export NODE_BINARY=node export SOURCEMAP_FILE="$(pwd)/../ios.jsbundle.map" ../node_modules/react-native/scripts/react-native-xcode.sh ``` 4. Make a release build `npx react-native run-ios --configuration Release` or `CMD + I` in xCode 5. Verify the build is successful 6. Verify the `.map` file is outputted at the specified path (`ios.jsbundle.map` in project root for the example above) Reviewed By: cipolleschi Differential Revision: D38460586 Pulled By: dmitryrykun fbshipit-source-id: 54c1594b37fa2253896ce9739c1a9a712deecd0f
kelset
pushed a commit
that referenced
this issue
Jun 8, 2023
Summary: ## Summary Fixes #32497 Fixes #34212 The assigned HBC_SOURCEMAP_FILE path is incorrect as it does not reference the hermes bundle source map file See: #32497 (comment) ## Changelog [General] [Fixed] - using SOURCEMAP_FILE during xcode build phase with Hermes enabled Pull Request resolved: #34111 Test Plan: 1. In a blank react-native project 1. Enable Hermes 1. Go to xCode -> Project -> Build Phases -> Bundle React Native code and images 3. Add `export SOURCEMAP_FILE="$(pwd)/../ios.jsbundle.map"` before `react-native-xcode.sh` e.g. ```sh export NODE_BINARY=node export SOURCEMAP_FILE="$(pwd)/../ios.jsbundle.map" ../node_modules/react-native/scripts/react-native-xcode.sh ``` 4. Make a release build `npx react-native run-ios --configuration Release` or `CMD + I` in xCode 5. Verify the build is successful 6. Verify the `.map` file is outputted at the specified path (`ios.jsbundle.map` in project root for the example above) Reviewed By: cipolleschi Differential Revision: D38460586 Pulled By: dmitryrykun fbshipit-source-id: 54c1594b37fa2253896ce9739c1a9a712deecd0f
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Description
When generating a sourcemap file in a build with Hermes enabled in iOS, the generated file is incorrect.
When looking into the build logs from XCode, I realized that the
HBC_SOURCEMAP_FILE
andPACKAGER_SOURCEMAP_FILE
shared the same location (if theSOURCEMAP_FILE
is namedmain.jsbundle.map
).I believe
HBC_SOURCEMAP_FILE
is not pointing to the right path, as it is in$DEST
and not in$CONFIGURATION_BUILD_DIR
.This can be solved in
scripts/react-native-xcode.sh
if we move the lineBUNDLE_FILE="$DEST/main.jsbundle"
above the sourcemap composition command, like so:I'm ok to open a Pull Request with this change :)
This may be linked to #34043
Version
0.69.0
Output of
npx react-native info
System:
OS: macOS 12.4
CPU: (10) arm64 Apple M1 Pro
Memory: 184.34 MB / 32.00 GB
Shell: 5.8.1 - /opt/homebrew/bin/zsh
Binaries:
Node: 18.0.0 - /opt/homebrew/bin/node
Yarn: 1.22.18 - /opt/homebrew/bin/yarn
npm: 8.6.0 - /opt/homebrew/bin/npm
Watchman: 2022.03.21.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.11.3 - /Users/louis.zawadzki/.rbenv/shims/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.1 AI-211.7628.21.2111.8309675
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.0.0 => 18.0.0
react-native: 0.69.0 => 0.69.0
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found
Steps to reproduce
Podfile
, runpod install
export SOURCEMAP_FILE=./build/main.jsbundle.map
line at the top of the "Bundle React Native code and images" build phaseSnack, code example, screenshot, or link to a repository
Path to sourcemaps files without any change - they are identical:

After the change,

HBC_SOURCEMAP_FILE
points to the right location:The text was updated successfully, but these errors were encountered: