Skip to content

Commit

Permalink
fix workers in prod hub
Browse files Browse the repository at this point in the history
  • Loading branch information
berekuk committed Dec 5, 2024
1 parent 0007c55 commit 1d0d10a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/squiggle-lang/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"build": "pnpm run build:peggy && pnpm run build:ts && pnpm run build:worker",
"build:peggy": "peggy --cache --format es ./src/ast/peggyParser.peggy",
"build:ts": "tsc -b",
"build:worker": "esbuild src/runners/worker.ts --bundle --minify --platform=browser --outfile=dist/runners/esbuild-worker.cjs",
"build:worker": "esbuild src/runners/worker.ts --bundle --minify --platform=browser --format=esm --outfile=dist/runners/esbuild-worker.js",
"dev": "tsc -b -w",
"clean": "rm -rf dist && rm -f src/ast/peggyParser.js && rm *.tsbuildinfo",
"jest": "NODE_OPTIONS=--experimental-vm-modules jest",
Expand Down
7 changes: 5 additions & 2 deletions packages/squiggle-lang/src/runners/WebWorkerRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ export class WebWorkerRunner extends AnyWorkerRunner {
*
* But, for now, it seems like it's working.
*/
const url = new URL("./esbuild-worker.cjs", import.meta.url);
this.worker = new Worker(url);

// Note: the version below is configured to work for pre-turbopack next.js in dev and prod.
this.worker = new Worker(new URL("./esbuild-worker.js", import.meta.url), {
type: "module",
});
}

async getWorker(): Promise<Worker> {
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1d0d10a

Please sign in to comment.