Skip to content

[0.72] Allow RCTBundleURLProvider to request an inline source map - #39033

Merged
fortmarek merged 1 commit into
react:0.72-stablefrom
Saadnajmi:inline-72
Sep 4, 2023
Merged

[0.72] Allow RCTBundleURLProvider to request an inline source map#39033
fortmarek merged 1 commit into
react:0.72-stablefrom
Saadnajmi:inline-72

Conversation

@Saadnajmi

@SaadnajmiSaadnajmi commented Aug 16, 2023

Copy link
Copy Markdown
Contributor

Cherry-pick of #37878 to 0.72-stable

Changelog:

[IOS] [ADDED] - Added support to inline the source map via RCTBundleURLProvider

@facebook-github-botfacebook-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. p: Microsoft Partner: Microsoft Partner labels Aug 16, 2023
@github-actions

github-actionsBot commented Aug 16, 2023

Copy link
Copy Markdown
Warnings
⚠️📋 Missing Summary - Can you add a Summary? To do so, add a "## Summary" section to your PR description. This is a good place to explain the motivation for making this change.
⚠️📋 Missing Test Plan - Can you add a Test Plan? To do so, add a "## Test Plan" section to your PR description. A Test Plan lets us know how these changes were tested.

Generated by 🚫 dangerJS against dc8a103

@analysis-bot

analysis-bot commented Aug 16, 2023

Copy link
Copy Markdown
PlatformEngineArchSize (bytes)Diff
androidhermesarm64-v8a8,491,710-456,426
androidhermesarmeabi-v7a7809502n/a
androidhermesx868961523n/a
androidhermesx86_648822847n/a
androidjscarm64-v8a9,151,448-390,053
androidjscarmeabi-v7a8340954n/a
androidjscx869204406n/a
androidjscx86_649463158n/a

Base commit: be2bb51
Branch: main

Summary:
See: http://blog.nparashuram.com/2019/10/debugging-react-native-ios-apps-with.html
When using direct debugging with JavaScriptCore, Safari Web Inspector doesn't pick up the source map over the network. Instead, as far as I can tell, it expects you to pass the source URL at the time you load your bundle: https://developer.apple.com/documentation/javascriptcore/jscontext/1451384-evaluatescript?language=objc . This leads to a very sub-par developer experience debugging the JSbundle directly. It will however, pick up an inline source map. Therefore, let's add a way to have React Native tell metro to request an inline source map.
I did this by modifying `RCTBundleURLProvider` to have a new query parameter for `inlineSourceMap`, and set to true by default for JSC.
[IOS] [ADDED] - Added support to inline the source map via RCTBundleURLProvider
Pull Request resolved: react#37878
Test Plan:
I can put a breakpoint in RNTester, via Safari Web Inspector, in human readable code :D
<img width="1728" alt="Screenshot 2023-06-14 at 4 09 03 AM" src="https://github.com/facebook/react-native/assets/6722175/055277fa-d887-4566-9dc6-3ea07a1a60b0">
Reviewed By: motiz88
Differential Revision: D46855418
Pulled By: huntie
fbshipit-source-id: 2134cdbcd0a3e81052d26ed75f83601ae4ddecfe
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA SignedThis label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.p: MicrosoftPartner: MicrosoftPartnerPick Request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@Saadnajmi@analysis-bot@fortmarek@facebook-github-bot