Repository navigation
fix: builtin resolution of electron modules via asar hook - #324861
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes builtin resolution of Electron modules in the ESM asar loader hook (bootstrap-esm.ts). Electron injects a synthetic electron module (also reachable as electron/main, electron/common, electron/renderer) that resolves to the electron: URL scheme rather than a real file, and node:module#isBuiltin does not recognize it. Without special handling, the resolve hook would attempt to redirect these specifiers into the node_modules.asar archive, which is incorrect. The fix detects Electron builtins explicitly and skips archive redirection for them, addressing the five linked vscode-engineering issues.
Changes:
- Add an
isElectronBuiltinhelper that matcheselectronandelectron/*specifiers. - Extend the archive-resolution guard in the ESM
resolvehook to bypass Electron builtins, deferring to the default resolver.
Collaborator
Author
Robo (deepak1556)
marked this pull request as ready for review
July 8, 2026 04:52
Kyle Cutler (kycutler)
approved these changes
Jul 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes https://github.com/microsoft/vscode-engineering/issues/3228
Fixes https://github.com/microsoft/vscode-engineering/issues/3227
Fixes https://github.com/microsoft/vscode-engineering/issues/3226
Fixes https://github.com/microsoft/vscode-engineering/issues/3225
Fixes https://github.com/microsoft/vscode-engineering/issues/3224