vscode: Use ESM modules

A vscode extension must use CJS, but that code may use ESM modules in
turn.

So update to ESM, fixing a warning when importing our WASM code.
This commit is contained in:
Tobias Hunger 2023-10-16 11:43:58 +02:00 committed by Tobias Hunger
parent d9672c5a21
commit cb66bc1650
3 changed files with 4 additions and 4 deletions

View file

@ -50,7 +50,7 @@ esbuild
entryPoints: ["src/browser-lsp-worker.ts"],
bundle: true,
outfile: "out/browserServerMain.js",
format: "iife",
format: "esm",
platform: "browser",
plugins: [wasmPlugin],
})
@ -79,6 +79,6 @@ esbuild
bundle: true,
outfile: "out/propertiesView.js",
platform: "browser",
format: "iife",
format: "esm",
})
.catch(() => process.exit(1));

View file

@ -47,7 +47,7 @@ function startClient(
"out/browserServerMain.js",
);
const worker = new Worker(serverMain.toString(true));
const worker = new Worker(serverMain.toString(true), { type: "module" });
worker.onmessage = (m) => {
// We cannot start sending messages to the client before we start listening which
// the server only does in a future after the wasm is loaded.

View file

@ -293,7 +293,7 @@ export class PropertiesViewProvider implements vscode.WebviewViewProvider {
<link href="${codiconsUri}" rel="stylesheet" />
</head>
<body class="properties-editor">
<script src="${scriptUri}"></script>
<script src="${scriptUri}" type="module"></script>
</body>
</html>`;
}