Skip to content

Commit

Permalink
Hardcode the search worker entry to avoid visible error messages in F…
Browse files Browse the repository at this point in the history
…irefox.

Users of the CDN can't prevent the worker failure messages, so they are just noise (and a potential slowdown). This hardcodes the entry file path where the instantiator (which reliably ends up in a chunk for us) expects it: https://github.com/cubing/cubing.js/blob/4afc6d727549aadc1e82abf52d531565953e7a9a/src/cubing/search/worker-workarounds/index.ts#L11

I would prefer to avoid hardcoding any paths except those that are published as CDN entry points, but `esbuild` still doesn't support `new URL(…, import.meta.url)` (evanw/esbuild#312) or `import.meta.resolve(…)` (evanw/esbuild#2866).
  • Loading branch information
lgarron committed Sep 8, 2023
1 parent da82ad2 commit 7688323
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion script/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,15 @@ const result = await build({
external: ["node:*"],
sourceRoot: "./src/js",
outdir: join(DIST_CDN, "js"),
entryPoints: ["./src/js/**/*.ts"],
entryPoints: [
"./src/js/**/*.ts",
{
// Hardcode the search worker entry to avoid error messages in Firefox.
// TODO: Remove this if https://github.com/evanw/esbuild/issues/312 or https://github.com/evanw/esbuild/issues/2866 is ever implemented.
in: "node_modules/cubing/dist/cubing/search-worker-entry.js",
out: "search-worker-entry",
},
],
});

await build({
Expand Down

0 comments on commit 7688323

Please sign in to comment.