[]previous and next page

The production build

dusk build does four things in order, all inside the Dusk plugin: it builds the client bundle, builds the server bundle, prerenders the pages that ask for it into the…

For agentsUpdated

dusk build does four things in order, all inside the Dusk plugin: it builds the client bundle, builds the server bundle, prerenders the pages that ask for it into the client folder, and writes dist/dusk-manifest.json. It also rewrites src/routeTree.gen.ts first, as dusk dev does. The command runs Vite's build underneath, so its log is Vite's. This is the output of the build of the files above (Vite 8.3.3, colors removed, one warning explained below):

text
vite v8.3.3 building client environment for production...
transforming...
✓ 26 modules transformed.
rendering chunks...
computing gzip size...
dist/client/.vite/manifest.json               1.72 kB │ gzip:  0.37 kB
dist/client/assets/routes-C1UBeNzz.js         0.11 kB │ gzip:  0.12 kB
dist/client/assets/dashboard-By0TltSM.js      0.11 kB │ gzip:  0.12 kB
dist/client/assets/about-B-9uNwTG.js          0.11 kB │ gzip:  0.12 kB
dist/client/assets/_id_-CTfrKhEj.js           0.20 kB │ gzip:  0.17 kB
dist/client/assets/client-entry-089QpbI5.js   7.75 kB │ gzip:  3.20 kB
dist/client/assets/prod-KjMruBBF.js          27.55 kB │ gzip:  9.88 kB
dist/client/assets/prod-pOXGxgVI.js          44.80 kB │ gzip: 15.24 kB
✓ built in 28ms
vite v8.3.3 building ssr environment for production...
transforming...
✓ 25 modules transformed.
rendering chunks...
computing gzip size...
dist/server/chunks/info-BJM9ab_v.js    0.14 kB │ gzip:  0.13 kB
dist/server/entry.js                 153.04 kB │ gzip: 44.98 kB
✓ built in 20ms
text
dist/
  client/                      what a browser may download
    .vite/manifest.json        Vite's manifest (a dotfile: the Node server does not serve it)
    assets/                    content-hashed JavaScript and CSS
    about/index.html           prerendered pages, one folder per path
    dashboard/index.html       the shell of a route with `ssr = false`
    posts/1/index.html
    posts/2/index.html
  server/
    entry.js                   the request handler; exports `handler` (also the default export) and `manifest`
    chunks/                    lazily loaded API routes and server functions
  dusk-manifest.json          what the build produced, for tools and deploy scripts

The framework packages are bundled into dist/server/entry.js; the build above produced a file with no import at all. Packages that your own server code imports, such as a database driver, are not bundled by Vite's server build and stay imports, so they belong in dependencies. The file that starts the server (serve.mjs) needs @shadow-js/dusk installed at run time. The client bundle is the only thing sent to browsers, so the server code, the secrets it reads and the server functions' bodies are not in it. dusk-manifest.json has these fields (abridged: two of the four routes):

json
{
  "version": 1,
  "buildId": "JJVnkU_252S951K0",
  "base": "/",
  "entry": "assets/client-entry-089QpbI5.js",
  "css": [],
  "routes": {
    "/about": { "kind": "page", "file": "src/routes/about.tsx", "preload": ["assets/about-B-9uNwTG.js"], "prerender": true },
    "/dashboard": { "kind": "page", "file": "src/routes/dashboard.tsx", "preload": ["assets/dashboard-By0TltSM.js"], "ssr": false }
  },
  "api": [{ "id": "/api/info", "file": "src/routes/api/info.ts", "methods": ["GET"] }],
  "serverFns": {},
  "prerendered": ["/about", "/dashboard", "/posts/1", "/posts/2"]
}
Field Meaning
version format version, 1
buildId hash of the client asset names, or the buildId option of dusk(); the same sources give the same id
base Vite's base (/ or /app/)
entry, css the client entry script and the stylesheets every page needs, relative to dist/client
routes page and layout routes by id: source file, the chunks to preload, and the ssr and prerender exports when set
api API routes with the methods they export
serverFns server functions by id: file, export name, GET or POST
prerendered paths written to dist/client by this build

dusk() options that matter for deployment: outDir (default dist), prerender (see below), buildId, and maxPreloadsPerRoute (24).