From fb8dcdfbeb356d1bb159e23b537f9213bb01baeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Vouillon?= Date: Thu, 23 Nov 2023 09:36:06 +0100 Subject: [PATCH] Fix launch script to work in Web workers Fixes #9 --- runtime/wasm/runtime.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/runtime/wasm/runtime.js b/runtime/wasm/runtime.js index 3b28f9d3a..af56a9310 100644 --- a/runtime/wasm/runtime.js +++ b/runtime/wasm/runtime.js @@ -6,7 +6,8 @@ return require('fs/promises').readFile(f) } function fetchRelative(src) { - const url = new URL (src, document.currentScript?.src || document.baseURI).href + const base = globalThis?.document?.currentScript?.src; + const url = base?new URL(src, base):src; return fetch(url) } const isNode = globalThis?.process?.versions?.node;