fix: properly bundle and cache frontend assets

- Build frontend assets natively with Bun to dist/public/ via `src/index.html` entrypoint
- Serve static assets in production with `Cache-Control: public, max-age=31536000, immutable` caching headers
- Preserve native `bun run dev` routing for seamless HMR by retaining development mode conditions in the server router
- Exclude `index.html` from long-term cache headers to allow for production updates
This commit is contained in:
ruinivist
2026-05-29 18:14:25 +00:00
parent 9b44356782
commit 17d01aff21
2 changed files with 39 additions and 3 deletions
+1 -1
View File
@@ -4,7 +4,7 @@
"private": true,
"scripts": {
"dev": "bun --hot src/server.tsx",
"build": "rm -rf dist && bun build --target=bun ./src/server.tsx --outdir ./dist",
"build": "rm -rf dist && bun build --minify --target=browser ./src/index.html --outdir ./dist/public && bun build --target=bun ./src/server.tsx --outdir ./dist",
"start": "cd dist && DATABASE_PATH=../data/excalidraw.sqlite bun ./server.js",
"test": "bun test",
"typecheck": "tsc --noEmit"