diff --git a/src/bootstrap-esm.ts b/src/bootstrap-esm.ts index 54681a2..39f72ad 100644 --- a/src/bootstrap-esm.ts +++ b/src/bootstrap-esm.ts @@ -6,3 +6,3 @@ import * as fs from 'node:fs'; -import { register } from 'node:module'; +import * as Module from 'node:module'; import { product, pkg } from './bootstrap-meta.js'; @@ -13,3 +13,3 @@ import { INLSConfiguration } from './vs/nls.js'; // Install a hook to module resolution to map 'fs' to 'original-fs' -if (process.env['ELECTRON_RUN_AS_NODE'] || process.versions['electron']) { +if (Module.register && (process.env['ELECTRON_RUN_AS_NODE'] || process.versions['electron'])) { const jsCode = ` @@ -28,3 +28,4 @@ if (process.env['ELECTRON_RUN_AS_NODE'] || process.versions['electron']) { }`; - register(`data:text/javascript;base64,${Buffer.from(jsCode).toString('base64')}`, import.meta.url); + // @ts-ignore + Module.register(`data:text/javascript;base64,${Buffer.from(jsCode).toString('base64')}`, import.meta.url); }