chore: updated cf deps, improved vite dev

This commit is contained in:
dswbx
2025-09-20 13:59:41 +02:00
parent 806b7427c1
commit 50e9be833b
6 changed files with 188 additions and 275 deletions

View File

@@ -9,18 +9,28 @@ export const PLATFORMS = ["node", "bun"] as const;
export type Platform = (typeof PLATFORMS)[number];
export async function serveStatic(server: Platform): Promise<MiddlewareHandler> {
const onNotFound = (path: string) => {
$console.debug("Couldn't resolve static file at", path);
};
switch (server) {
case "node": {
const m = await import("@hono/node-server/serve-static");
const root = getRelativeDistPath() + "/static";
$console.log("Serving static files from", root);
return m.serveStatic({
// somehow different for node
root: getRelativeDistPath() + "/static",
root,
onNotFound,
});
}
case "bun": {
const m = await import("hono/bun");
const root = path.resolve(getRelativeDistPath(), "static");
$console.log("Serving static files from", root);
return m.serveStatic({
root: path.resolve(getRelativeDistPath(), "static"),
root,
onNotFound,
});
}
}