diff --git a/src/node/main.ts b/src/node/main.ts index 0458f66ad..f331ae59f 100644 --- a/src/node/main.ts +++ b/src/node/main.ts @@ -49,7 +49,9 @@ export interface OpenCommandPipeArgs { export const runCodeCli = async (args: DefaultedArgs): Promise => { logger.debug("Running Code CLI") try { - const mod = require(path.join(vsRootPath, "out/server-main")) as VSCodeModule + // See vscode.loadVSCode for more on this jank. + const modPath = path.join(vsRootPath, "out/server-main.js") + const mod = (await eval(`import("${modPath}")`)) as VSCodeModule const serverModule = await mod.loadCodeWithNls() await serverModule.spawnCli(await toCodeArgs(args)) // Rather than have the caller handle errors and exit, spawnCli will exit