From 5fc87cc85c5006706a6937b2637d1ded5e001685 Mon Sep 17 00:00:00 2001 From: Logan Daniels Date: Mon, 16 Oct 2023 16:46:32 -0700 Subject: [PATCH] Pass http:// prefix in VR source map URLs Summary: Horizon devs use the Chrome debugging protocol which has the similar `http://` protocol expectation as explained in the comment here. After fb-metro upgrade, the `//` protocol is being used which breaks source mapping when debugging Horizon. Fix it by including `vr` in the platform check here. Is there any chance this would break debugging for some other users who might still be passing VR as platform? I feel like it's safe but just checking. Not sure a good way to fix this otherwise Reviewed By: motiz88 Differential Revision: D49936311 fbshipit-source-id: b4b1d1c16412393691a7d943c7af3467836a78b2 --- packages/metro/src/lib/parseOptionsFromUrl.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/metro/src/lib/parseOptionsFromUrl.js b/packages/metro/src/lib/parseOptionsFromUrl.js index a6ad03ff3a..f2e35366e7 100644 --- a/packages/metro/src/lib/parseOptionsFromUrl.js +++ b/packages/metro/src/lib/parseOptionsFromUrl.js @@ -74,8 +74,9 @@ module.exports = function parseOptionsFromUrl( // protocol is blob:http. This breaks loading source maps through // protocol-relative URLs, which is why we must force the HTTP protocol // when loading the bundle for either Android or iOS. + // TODO(T167298674): Remove when remote debugging is not needed in React Native protocol: - platform != null && platform.match(/^(android|ios)$/) ? 'http' : '', + platform != null && platform.match(/^(android|ios|vr)$/) ? 'http' : '', pathname: pathname.replace(/\.(bundle|delta)$/, '.map'), }), sourceUrl: jscSafeUrl.toJscSafeUrl(normalizedRequestUrl),