Production client bundle
Browser Bun.build entry hashing Tailwind CSS HTML rewriting assets copy NODE_ENV define.
Production client bundle
The browser graph is produced by Bun.build in packages/manic/src/cli/commands/build.ts immediately after writeRoutesManifest.
Entry resolution
oxc-resolver resolves ./app/main → app/main.tsx (or .jsx). Missing entry aborts the build with Core entry 'app/main.tsx' not found.
Bun.build options (client)
| Field | Value |
|---|---|
target | browser |
outdir | <dist>/client |
plugins | oxcPlugin() + bun-plugin-tailwind |
define | process.env.NODE_ENV → "production" |
naming | entry, chunks/, assets/ — all include content hashes |
Hashed filenames give immutable caching (Cache-Control headers come from createManicServer static paths).
HTML stitching
After Bun.build completes:
- Locate
entry-pointJS output + optional.cssartifact from Tailwind. - Read
app/index.htmlwhen present; otherwise synthesize minimal#rootshell. - Replace
href="tailwindcss"placeholder or inject<link href="/…css">before</head>. - Replace
src="./main.tsx"//main.tsxwith hashed/<main-js>, or appendtype="module"script before</body>. - Write
<dist>/client/index.html>.
Plugins then run build() and may injectHtml — accumulated tags splice before </head> again.
Static assets
Root assets/ (if present) copies verbatim to <dist>/client/assets — favicons and fixed URLs survive independent of hashed bundles.
Performance angle
- Single graph — one
entrypointsarray keeps critical path simple versus multi-entry portals. - OXC
target: es2022in prod avoids shipping legacy polyfills unless your deps require them. - Parallel minification happens later across
client/,api/,server.js(Build pipeline).