Skip to content
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

Fix HBC_SOURCEMAP_FILE in scripts/react-native-xcode.sh #34111

Closed
wants to merge 1 commit into from
Closed

Fix HBC_SOURCEMAP_FILE in scripts/react-native-xcode.sh #34111

wants to merge 1 commit into from

Conversation

kidroca
Copy link
Contributor

@kidroca kidroca commented Jun 30, 2022

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

Test Plan

  1. In a blank react-native project
  2. Enable Hermes
  3. Go to xCode -> Project -> Build Phases -> Bundle React Native code and images
  4. Add export SOURCEMAP_FILE="$(pwd)/../ios.jsbundle.map" before react-native-xcode.sh
    e.g.
    export NODE_BINARY=node
    export SOURCEMAP_FILE="$(pwd)/../ios.jsbundle.map"
    
    ../node_modules/react-native/scripts/react-native-xcode.sh
  5. Make a release build npx react-native run-ios --configuration Release or CMD + I in xCode
  6. Verify the build is successful
  7. Verify the .map file is outputted at the specified path (ios.jsbundle.map in project root for the example above)

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. labels Jun 30, 2022
Copy link
Contributor Author

@kidroca kidroca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

Addresses #32497

The assigned HBC_SOURCEMAP_FILE path is incorrect as it does not reference the hermes bundle source map file

See: #32497 (comment)

@analysis-bot
Copy link

analysis-bot commented Jun 30, 2022

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 7,610,280 -13
android hermes armeabi-v7a 7,025,994 -9
android hermes x86 7,910,168 -6
android hermes x86_64 7,883,441 +3
android jsc arm64-v8a 9,488,705 -2
android jsc armeabi-v7a 8,266,578 -7
android jsc x86 9,426,078 -5
android jsc x86_64 10,018,839 +15

Base commit: 33dbb6c
Branch: main

@analysis-bot
Copy link

analysis-bot commented Jun 30, 2022

Platform Engine Arch Size (bytes) Diff
ios - universal n/a --

Base commit: b4f6262
Branch: main

@facebook-github-bot
Copy link
Contributor

@dmitryrykun has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@dmytrorykun
Copy link
Contributor

Hey @kidroca, could you please rebase this PR on top of main to make CI happy?

@kidroca
Copy link
Contributor Author

kidroca commented Aug 8, 2022

Hey @kidroca, could you please rebase this PR on top of main to make CI happy?

Rebased

@facebook-github-bot
Copy link
Contributor

@dmitryrykun has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@kidroca kidroca deleted the kidroca/fixes/react-native-xcode.sh branch August 8, 2022 16:17
roryabraham pushed a commit to Expensify/react-native that referenced this pull request 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 pull request 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
@iBotPeaches
Copy link
Contributor

Not to hijack a merged issue, but after reading this and wanting to debug some Hermes source maps I can't find a single official source for enabling basic sourcemaps on ios w/ Hermes. Which is possible - I'm just blind, but I've spent a few hours on this.

  • Stackoverflow says EXTRA_PACKAGER_ARGS
  • Sentry has their own script I presume they RE`d from here
  • Bugsnag has their own script as well
  • Official docs only mention the Android process

I ended up trying this via reading this merge.

export SOURCEMAP_FILE=\"$(pwd)/../main.jsbundle.map\";

Prior to "Bundle React Native code and images" step where the exported vars are being set. This seemed to work great, but I'm unsure if 4 sources say 4 different things what is expected. I can assure you with any official help here to point to what is officially recommend - I will turn around and PR the docs for the process.

@dmytrorykun
Copy link
Contributor

@iBotPeaches, yeah, defining SOURCEMAP_FILE envvar is the right way for enabling source maps.

@iBotPeaches
Copy link
Contributor

iBotPeaches commented Sep 1, 2022

thanks @dmitryrykun

Working on a doc pr now.

@iBotPeaches
Copy link
Contributor

Started a brand new doc for sourcemaps - facebook/react-native-website#3293 - ready for feedback.

kelset pushed a commit that referenced this pull request 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
Bug CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.
Projects
None yet
6 participants