* Use Dist folder instead of runtime hosting Signed-off-by: Indrajith K L <indrajith@indrajith.dev>
25 lines
647 B
TypeScript
25 lines
647 B
TypeScript
import tailwind from "bun-plugin-tailwind";
|
|
import { rm } from "node:fs/promises";
|
|
import path from "node:path";
|
|
|
|
const outdir = path.join(process.cwd(), "dist");
|
|
await rm(outdir, { recursive: true, force: true });
|
|
|
|
const entrypoints = [...new Bun.Glob("src/**/*.html").scanSync()];
|
|
|
|
const result = await Bun.build({
|
|
entrypoints,
|
|
outdir,
|
|
plugins: [tailwind],
|
|
minify: true,
|
|
target: "browser",
|
|
sourcemap: "none",
|
|
define: {
|
|
"process.env.NODE_ENV": JSON.stringify("production"),
|
|
},
|
|
});
|
|
|
|
for (const output of result.outputs) {
|
|
console.log(` ${path.relative(process.cwd(), output.path)} ${(output.size / 1024).toFixed(1)} KB`);
|
|
}
|