6
6
import * as path from 'path' ;
7
7
import * as fs from 'fs' ;
8
8
import { fileURLToPath } from 'url' ;
9
- import { createRequire , register } from 'node:module' ;
9
+ import { createRequire /* , register */ } from 'node:module' ;
10
10
import { product , pkg } from './bootstrap-meta.js' ;
11
11
import './bootstrap-node.js' ;
12
12
import * as performance from './vs/base/common/performance.js' ;
@@ -15,24 +15,25 @@ import { INLSConfiguration } from './vs/nls.js';
15
15
const require = createRequire ( import . meta. url ) ;
16
16
const __dirname = path . dirname ( fileURLToPath ( import . meta. url ) ) ;
17
17
18
+ // This is only relevant for electron in vscode desktop
18
19
// 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
+ // }
36
37
37
38
// Prepare globals that are needed for running
38
39
globalThis . _VSCODE_PRODUCT_JSON = { ...product } ;
0 commit comments