atmosphere explorer
pds.ls
tool
typescript
atproto
1import { build } from "esbuild";
2import { copyFileSync } from "fs";
3import { resolve, dirname } from "path";
4import { fileURLToPath } from "url";
5
6const __dirname = dirname(fileURLToPath(import.meta.url));
7const wasmSrc = resolve(__dirname, "../node_modules/@takumi-rs/wasm/pkg/takumi_wasm_bg.wasm");
8
9await build({
10 entryPoints: ["src/worker.js"],
11 bundle: true,
12 outfile: "dist/_worker.js",
13 format: "esm",
14 platform: "browser",
15 target: "es2022",
16 external: ["*.wasm"],
17 minify: true,
18});
19
20copyFileSync(wasmSrc, "dist/takumi_wasm_bg.wasm");
21
22console.log("Worker built successfully.");