@@ -5,6 +5,7 @@ import { promises as fs } from "fs"
5
5
import * as http from "http"
6
6
import * as net from "net"
7
7
import * as path from "path"
8
+ import * as os from "os"
8
9
import { WebsocketRequest } from "../../../typings/pluginapi"
9
10
import { logError } from "../../common/util"
10
11
import { CodeArgs , toCodeArgs } from "../cli"
@@ -58,7 +59,11 @@ async function loadVSCode(req: express.Request): Promise<IVSCodeServerAPI> {
58
59
// which will also require that we switch to ESM, since a hybrid approach
59
60
// breaks importing `rotating-file-stream` for some reason. To work around
60
61
// 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
+ }
62
67
const mod = ( await eval ( `import("${ modPath } ")` ) ) as VSCodeModule
63
68
const serverModule = await mod . loadCodeWithNls ( )
64
69
return serverModule . createServer ( null , {
0 commit comments