Metro: out of tree platform sourcemap URL incorrectly lacks http protocol

Created on 21 May 2019  路  1Comment  路  Source: facebook/metro

Do you want to request a feature or report a bug?
Report a bug

What is the current behavior?
See microsoft/react-native-windows#2482.

Sourcemap URLs end up with the format //localhost:8081/App.uwp.map?platform=uwp... on react-native-windows, which breaks because of the Blob loading done in the debugger UI.
Metro specifically fixes this on android and iOS here:

        // The remote chrome debugger loads bundles via Blob urls, whose
        // 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 iOS or Android.
        protocol:
          platform != null && platform.match(/^(android|ios)$/) ? 'http' : '',

but because react-native-windows uses "uwp" as the platform, it continues to have the same issue.

If the current behavior is a bug, please provide the steps to reproduce and a minimal repository on GitHub that we can yarn install and yarn test.
See repro steps in microsoft/react-native-windows#2482

What is the expected behavior?
metro returns a sourceMapUrl with a protocol of http, instead of no protocol, on uwp platforms. Ideally Metro does not have to end up maintaining an exhaustive list of react native platforms, so perhaps a way to configure this behavior?

Please provide your exact Metro configuration and mention your Metro, node, yarn/npm version and operating system.
[email protected]
[email protected]
[email protected]
OS: Windows 10

Most helpful comment

This affects other out-of-tree platforms as well.

>All comments

This affects other out-of-tree platforms as well.

Was this page helpful?
0 / 5 - 0 ratings