This repository was archived by the owner on May 15, 2026. It is now read-only.
fix: add navigator shim for Node.js 22+ compatibility in code-server - #10400
Closed
ghost wants to merge 2 commits into
Closed
fix: add navigator shim for Node.js 22+ compatibility in code-server#10400ghost wants to merge 2 commits into
ghost wants to merge 2 commits into
Conversation
Author
Review complete. All previously identified issues have been addressed.
Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
ghost
commented
Dec 30, 2025
Co-authored-by: roomote[bot] <219738659+roomote[bot]@users.noreply.github.com>
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.
Related GitHub Issue
Closes: #10391
Description
This PR attempts to address Issue #10391 by adding a navigator shim in the esbuild configuration to fix the
PendingMigrationErrorthat occurs on code-server with Node.js 22+.The Problem:
In Node.js 22+,
navigatoris now a global object. Several bundled dependencies (debug, axios, pdf-parse) checktypeof navigator !== "undefined"and then try to access properties likenavigator.userAgent. VS Code's extension host intercepts these accesses and throwsPendingMigrationErrorto help extensions migrate.The Solution:
Added a JavaScript banner in the esbuild configuration that creates a safe navigator stub before any bundled code runs. The stub provides empty/default values for commonly accessed navigator properties:
userAgent,platform,appName,appVersion,product: empty stringsuserLanguage: undefinedlanguages: empty arrayhardwareConcurrency: 1standalone: falseonLine: trueThis shim is applied to both the extension and worker bundles via the shared
buildOptionsconfiguration.Test Procedure
node --check src/esbuild.mjsPre-Submission Checklist
Documentation Updates
Additional Notes
navigator.onLineaccess (Issue [Bug] Nightly build crashes with "PendingMigrationError: navigator is now a global in nodejs" #6356)_navigatorShimAppliedflag to prevent double application