Step 4: Build for Production

Prerequisites

Commands

Enable minification by editing src/site.json:

"build": { "minify": true, "debug": false }

Set identity.url to your production domain:

"identity": { "url": "https://yourdomain.com" }

Run the production build:

npm run build

Inspect the output:

find dist -maxdepth 2 -type f | sort

Expected Output

  • Fresh static files under dist/.
  • HTML is minified when build.minify is true.
  • CSS bundle: dist/output.css?v=7e5120dfbaf9 (Tailwind plugin, also minified).
  • JS bundle: dist/output.js?v=7e5120dfbaf9 (esbuild plugin, minified with sourcemap).
  • SEO files: dist/robots.txt, dist/sitemap.xml, dist/feed.xml.

What Just Happened

The build lifecycle executed in this order:

  1. ensureDist() - clears and recreates dist/.
  2. dist:clean hook - robots.txt generated.
  3. Static assets copied from src/assets/.
  4. assets:copy hook - Tailwind CSS and esbuild run.
  5. Markdown content loaded from src/content/.
  6. content:load hook - external content injection point.
  7. Collections built (tags, categories, series).
  8. content:ready hook - RSS and sitemap generated.
  9. Pages rendered and written to dist/.

Common Errors

ErrorFix
Missing output.css or output.jsVerify src/css/app.css and src/js/app.js exist and plugins are listed
Wrong language/path in outputCheck content.languages and canonical settings
Old files persist in outputBuild clears dist/ automatically; if issues persist, delete dist/ manually

Related