From eed566de4839d475f478a325ddcfc5604b81edeb Mon Sep 17 00:00:00 2001 From: Nils Bergmann Date: Thu, 30 May 2024 21:19:46 +0200 Subject: [PATCH] fix: worker url --- reactive_home/run.sh | 2 ++ src/runtime/loader.ts | 23 +++++++++-------------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/reactive_home/run.sh b/reactive_home/run.sh index 2730e5a..8d6f41b 100644 --- a/reactive_home/run.sh +++ b/reactive_home/run.sh @@ -24,5 +24,7 @@ console.log(file.imports['reactive-home']) PKG_VERSION=$(echo "$PKG_VERSION_SCRIPT" | deno run -) +cd /config/reactive-home + echo "Load runtime..." echo "import '$PKG_VERSION/runtime'" | deno run --import-map=/config/reactive-home/import_map.json --allow-env --allow-net --allow-run --allow-sys --allow-read - --root /config/reactive-home --pkg "$PKG_VERSION" \ No newline at end of file diff --git a/src/runtime/loader.ts b/src/runtime/loader.ts index f5c6929..cd80429 100644 --- a/src/runtime/loader.ts +++ b/src/runtime/loader.ts @@ -28,20 +28,15 @@ for await (const path of walk(flags.root)) { const loadWorker = async () => { while (true) { - console.info("Load script", path.path); - - const worker = new Worker( - new URL( - join(Deno.cwd(), path.path), - toFileUrl(join(Deno.cwd(), flags.root!)) - ).href, - { - type: "module", - deno: { - permissions: "inherit", - }, - } - ); + const scriptUrl = toFileUrl(join(Deno.cwd(), path.path)); + console.info("Load script", path.path, scriptUrl.href); + + const worker = new Worker(scriptUrl, { + type: "module", + deno: { + permissions: "inherit", + }, + }); await new Promise((resolve) => { worker.onerror = (error) => {