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/mainapp/main.tsx (or .jsx). Missing entry aborts the build with Core entry 'app/main.tsx' not found.


Bun.build options (client)

FieldValue
targetbrowser
outdir<dist>/client
pluginsoxcPlugin() + bun-plugin-tailwind
defineprocess.env.NODE_ENV"production"
namingentry, 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:

  1. Locate entry-point JS output + optional .css artifact from Tailwind.
  2. Read app/index.html when present; otherwise synthesize minimal #root shell.
  3. Replace href="tailwindcss" placeholder or inject <link href="/…css"> before </head>.
  4. Replace src="./main.tsx" / /main.tsx with hashed /<main-js>, or append type="module" script before </body>.
  5. 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 entrypoints array keeps critical path simple versus multi-entry portals.
  • OXC target: es2022 in prod avoids shipping legacy polyfills unless your deps require them.
  • Parallel minification happens later across client/, api/, server.js (Build pipeline).

See also

On this page