18 lines
491 B
TypeScript
18 lines
491 B
TypeScript
import { fileURLToPath } from "node:url";
|
|
|
|
export async function browserBundle(minify = false): Promise<Blob> {
|
|
const result = await Bun.build({
|
|
entrypoints: [fileURLToPath(new URL("../src/app.ts", import.meta.url))],
|
|
target: "browser",
|
|
format: "esm",
|
|
minify,
|
|
sourcemap: "none",
|
|
});
|
|
if (!result.success || !result.outputs[0]) {
|
|
throw new AggregateError(
|
|
result.logs,
|
|
"Browser TypeScript compilation failed",
|
|
);
|
|
}
|
|
return result.outputs[0];
|
|
}
|