Skip to content

Commit

Permalink
Pass http:// prefix in VR source map URLs
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Logan Daniels authored and facebook-github-bot committed Oct 16, 2023
1 parent ca0f89c commit 5fc87cc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/metro/src/lib/parseOptionsFromUrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 5fc87cc

Please sign in to comment.