Skip to content

Add support for experimental-inspector-network-resource #49500

Description

@ImVeryLost

Preflight Checklist

Problem Description

We use remote source maps (e.g. //# sourceMappingURL=https://something-deployed/index.js.map), in electron's main and utility processes. Historically, remote source maps for node.js applications could not be resolved by Chrome DevTools.

Now the situation has improved - in Node.js 22.19 they added --experimental-inspector-network-resource flag, which allows applications to manually add support for remote source map resolution

E.g. Imagine i have the following script:

import inspector from 'node:inspector';

async function setNetworkResources() {
  const mapUrl = 'http://localhost:4000/index.js.map';
  const distAppJsMap = await fetch(mapUrl).then((res) => res.text());
  inspector.NetworkResources.put(mapUrl, distAppJsMap);
  // TS source is included in the js.map, so we can skip the .ts fetch
};

setNetworkResources().then(() => {
  setInterval(() => {
    console.log("ping!")
  }, 5000)
}); 

If I compile the code and generate source maps, then run node --inspect=9230 --experimental-inspector-network-resource index.js, I can use Chromes 'dedicated DevTools for Node', and see that it successfully resolves source maps, allowing me to debug the original TS code.

Image

However, the same setNetworkResources doesn't work in electron, because it only supports a subset of Node.js flags.

Proposed Solution

Add support for --experimental-inspector-network-resource CLI flags for both main and utility processes.

Alternatives Considered

The only 'real' alternative is not to have source map resolution for main/utility processes in Chrome inspector (which is the current situation). It's not ideal, because there are developers who prefer using Chrome's inspector over VS Code

Additional Information

Long term, consider implementing setNetworkResources directly in electron (to provide remote source map resolution for all applications "out of the box") - I know it's a long shot, but I do think it might be useful for for other electron applications as well

Activity

  1. Bhumi0189 commented on Jan 23, 2026

    @Bhumi0189
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions