Skip to content

Commit da05e09

Browse files
jeanp413mustard-mh
authored andcommitted
[IMPORTANT] Patch so vscode is compatible with node 18
Tool: gitpod/catfood.gitpod.cloud
1 parent 36336a5 commit da05e09

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

src/bootstrap-esm.ts

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import * as path from 'path';
77
import * as fs from 'fs';
88
import { fileURLToPath } from 'url';
9-
import { createRequire, register } from 'node:module';
9+
import { createRequire/* , register */ } from 'node:module';
1010
import { product, pkg } from './bootstrap-meta.js';
1111
import './bootstrap-node.js';
1212
import * as performance from './vs/base/common/performance.js';
@@ -15,24 +15,25 @@ import { INLSConfiguration } from './vs/nls.js';
1515
const require = createRequire(import.meta.url);
1616
const __dirname = path.dirname(fileURLToPath(import.meta.url));
1717

18+
// This is only relevant for electron in vscode desktop
1819
// Install a hook to module resolution to map 'fs' to 'original-fs'
19-
if (process.env['ELECTRON_RUN_AS_NODE'] || process.versions['electron']) {
20-
const jsCode = `
21-
export async function resolve(specifier, context, nextResolve) {
22-
if (specifier === 'fs') {
23-
return {
24-
format: 'builtin',
25-
shortCircuit: true,
26-
url: 'node:original-fs'
27-
};
28-
}
29-
30-
// Defer to the next hook in the chain, which would be the
31-
// Node.js default resolve if this is the last user-specified loader.
32-
return nextResolve(specifier, context);
33-
}`;
34-
register(`data:text/javascript;base64,${Buffer.from(jsCode).toString('base64')}`, import.meta.url);
35-
}
20+
// if (process.env['ELECTRON_RUN_AS_NODE'] || process.versions['electron']) {
21+
// const jsCode = `
22+
// export async function resolve(specifier, context, nextResolve) {
23+
// if (specifier === 'fs') {
24+
// return {
25+
// format: 'builtin',
26+
// shortCircuit: true,
27+
// url: 'node:original-fs'
28+
// };
29+
// }
30+
31+
// // Defer to the next hook in the chain, which would be the
32+
// // Node.js default resolve if this is the last user-specified loader.
33+
// return nextResolve(specifier, context);
34+
// }`;
35+
// register(`data:text/javascript;base64,${Buffer.from(jsCode).toString('base64')}`, import.meta.url);
36+
// }
3637

3738
// Prepare globals that are needed for running
3839
globalThis._VSCODE_PRODUCT_JSON = { ...product };

0 commit comments

Comments
 (0)