Skip to content

Commit a7eaf5a

Browse files
committed
Fix loading of the LSP worker script in the online editor
The update to vite 4 triggered the vite 3 bug vitejs/vite#9879 for us, where the wasm-pack generated .js is included as iife and therefore the use of import.meta.url gets transpiled to some shim that tries to access the document, assuming that the JS is running in the browser instead of in a worker environment. Explicitly set the output type for the worker to ES modules, so that no changes are needed and import.meta.url remains in use. This matches the worker invocation anyway, as we pass "type": "module" to the Worker constructor.
1 parent 33dc95f commit a7eaf5a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tools/online_editor/vite.config.js

+3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ export default defineConfig(({ command, _mode }) => {
2121
// We need to enable support for bigint
2222
target: "safari14",
2323
},
24+
worker: {
25+
format: "es",
26+
},
2427
};
2528

2629
let global_aliases = {

0 commit comments

Comments
 (0)