Skip to content

Commit 1eb221a

Browse files
committed
fix: cwd when building client components
1 parent d976bc4 commit 1eb221a

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

example/2-client-component/app.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ import { Hono } from "hono";
22
import { serveStatic } from "hono/bun";
33
import { build } from "plainstack/bun";
44
import { render } from "plainstack/client";
5-
import { Counter } from "./counter";
5+
import { Counter } from "./client/counter";
66

77
const app = new Hono();
88

99
app.use("/static/*", serveStatic({ root: "./example/2-client-component" }));
1010

1111
await build({
12-
entrypoints: ["example/2-client-component/counter.tsx"],
12+
entrypoints: "example/2-client-component/client",
1313
outdir: "example/2-client-component/static",
1414
});
1515

src/bun.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Database } from "bun:sqlite";
22
import { randomBytes } from "node:crypto";
33
import { readdir } from "node:fs/promises";
4+
import { join } from "node:path";
45
import type { BuildConfig as BunBuildConfig } from "bun";
56
import { CamelCasePlugin, Kysely } from "kysely";
67
import { BunSqliteDialect } from "kysely-bun-sqlite";
@@ -46,12 +47,15 @@ type BuildConfig = Omit<BunBuildConfig, "entrypoints"> & {
4647
export async function build(options: BuildConfig) {
4748
const entrypointfiles =
4849
typeof options.entrypoints === "string"
49-
? await readdir(options.entrypoints)
50+
? await readdir(options.entrypoints).then((files) =>
51+
files.map((file) => join(options.entrypoints as string, file)),
52+
)
5053
: options.entrypoints;
54+
console.log(entrypointfiles);
5155
return await Bun.build({
5256
outdir: "static",
5357
sourcemap: "linked",
54-
minify: false, // TODO
58+
minify: prod(),
5559
...options,
5660
entrypoints: entrypointfiles,
5761
});

0 commit comments

Comments
 (0)