esbuild-wasm
browserからでも実行できる
もちろんpluginも使える
CDN経由ならjsdelivrが便利
Denoでの使用例
code:mod.ts
export const WASM_URL =
code:sh
code:test.ts
import { build, initialize, WASM_URL } from "./deps/esbuild-wasm.ts";
code:test.ts
await initialize({
wasmURL: WASM_URL,
worker: false,
});
const result = await build({
stdin: {
contents: "console.log('hello, world');",
sourcefile: "test.ts",
resolveDir: Deno.cwd(),
},
bundle: true,
minify: true,
format: "esm",
write: false,
});
console.log(result.outputFiles0.text);