@@ -5,6 +5,7 @@ import { promises as fs } from "fs"
55import * as http from "http"
66import * as net from "net"
77import * as path from "path"
8+ import * as os from "os"
89import { WebsocketRequest } from "../../../typings/pluginapi"
910import { logError } from "../../common/util"
1011import { CodeArgs , toCodeArgs } from "../cli"
@@ -58,7 +59,11 @@ async function loadVSCode(req: express.Request): Promise<IVSCodeServerAPI> {
5859 // which will also require that we switch to ESM, since a hybrid approach
5960 // breaks importing `rotating-file-stream` for some reason. To work around
6061 // this, use `eval` for now, but we should consider switching to ESM.
61- const modPath = path . join ( vsRootPath , "out/server-main.js" )
62+ let modPath = path . join ( vsRootPath , "out/server-main.js" )
63+ if ( os . platform ( ) === "win32" ) {
64+ // On Windows, absolute paths of ESM modules must be a valid file URI.
65+ modPath = "file:///" + modPath . replace ( / \\ / g, "/" )
66+ }
6267 const mod = ( await eval ( `import("${ modPath } ")` ) ) as VSCodeModule
6368 const serverModule = await mod . loadCodeWithNls ( )
6469 return serverModule . createServer ( null , {
0 commit comments