Skip to content

Commit

Permalink
fix: worker url
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNoim committed May 30, 2024
1 parent 8591157 commit eed566d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
2 changes: 2 additions & 0 deletions reactive_home/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
23 changes: 9 additions & 14 deletions src/runtime/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit eed566d

Please sign in to comment.