Revert dynamic HTML serving (broke Bun module bundling)

The serveGenerated() approach for index.html served raw HTML, which
broke bare module specifiers (import "motion") that Bun's HTML import
bundler normally resolves. Restore the static import pattern.

The live mode's auto-reload fallback still works for HMR-capable dev
servers (Vite, Next.js). For Bun's serve() with static HTML imports,
the dev server needs a restart to pick up HTML changes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Paul Bakaus
2026-04-12 18:52:37 -07:00
co-authored by Claude Opus 4.6
parent 05f5c0ba5b
commit 1671d04dec
+4 -2
View File
@@ -1,6 +1,8 @@
import { serve, file } from "bun";
import path from "node:path";
import { fileURLToPath } from "node:url";
import homepage from "../public/index.html";
import privacy from "../public/privacy.html";
import {
getSkills,
getCommands,
@@ -37,8 +39,8 @@ const server = serve({
port: process.env.PORT || 3000,
routes: {
"/": () => serveGenerated(path.join(ROOT_DIR, "public/index.html")),
"/privacy": () => serveGenerated(path.join(ROOT_DIR, "public/privacy.html")),
"/": homepage,
"/privacy": privacy,
// Legacy URL redirects (kept stable for external links and existing users).
"/cheatsheet": Response.redirect("/docs", 301),