Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.

Commit 815bcb2

Browse files
committed
fix: add navigator shim for Node.js 22+ compatibility
1 parent 6d8fa39 commit 815bcb2

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

src/esbuild.mjs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,27 @@ async function main() {
1717
const minify = production
1818
const sourcemap = true // Always generate source maps for error handling.
1919

20+
// Navigator shim for Node.js 22+ compatibility (fixes PendingMigrationError in code-server)
21+
// See: https://github.com/RooCodeInc/Roo-Code/issues/10391
22+
const navigatorShimBanner = `// Navigator shim for Node.js 22+ compatibility
23+
if (typeof globalThis !== "undefined" && !globalThis._navigatorShimApplied) {
24+
const navigatorStub = {
25+
userAgent: "",
26+
platform: "",
27+
userLanguage: undefined,
28+
appName: "",
29+
appVersion: "",
30+
product: "",
31+
languages: [],
32+
hardwareConcurrency: 1,
33+
standalone: false,
34+
onLine: true,
35+
};
36+
globalThis.navigator = globalThis.navigator || navigatorStub;
37+
globalThis._navigatorShimApplied = true;
38+
}
39+
`
40+
2041
/**
2142
* @type {import('esbuild').BuildOptions}
2243
*/
@@ -28,6 +49,9 @@ async function main() {
2849
format: "cjs",
2950
sourcesContent: false,
3051
platform: "node",
52+
banner: {
53+
js: navigatorShimBanner,
54+
},
3155
}
3256

3357
const srcDir = __dirname

0 commit comments

Comments
 (0)