GitHub v1.3.1
Lesson 13

Building for Production

From local development to a globally distributed static site. Ship with confidence.

The Pre-Flight Check

Before every production build, you should run the validator. It scans every component, page, and plugin for AST violations, unused refs, and dead CSS.

bash
Code copied!
  $ pnpm check
  
  ✔ 24 components validated
  ✔ 18 pages validated
  ✖ 2 warnings found (CORALITE-W402)
  
  $ pnpm fix
  ✔ Auto-fixed 2 warnings

The Build Engine

The pnpm build command orchestrates the entire pipeline: SSR evaluation, asset hashing, CSS scoping, and hydration JSON injection. It's built on top of an incremental manifest, so subsequent builds only recompile what changed.

bash
Code copied!
  $ pnpm build
  
  ▲ Building 18 pages...
  ✔ Compiling components...
  ✔ Scoping CSS...
  ✔ Generating hydration manifests...
  
  ✔ Build complete in 2.4s (incremental)

The dist/ Output

When the build completes, your entire site is placed in the dist/ directory. It is a flat folder of static files ready for any hosting provider.

text
Code copied!
dist/
├── index.html
├── learn/
│   └── 01-the-document.html
├── assets/
│   ├── css/
│   │   └── main-a1b2c3d4.css
│   └── js/
│       └── site-counter-9f8e7d6c.js
└── .coralite/
    └── manifest.json

Notice that assets are hashed (e.g., main-a1b2c3d4.css). This allows you to set infinite cache headers on your CDN without worrying about stale files.

Deployment

Because the output is static HTML, CSS, and JS, you can host Coralite on any static host: Netlify, Vercel, Cloudflare Pages, GitHub Pages, or a simple S3 bucket. There is no Node.js server required at runtime.

bash
Code copied!
  $ npx wrangler pages deploy dist/

Congratulations

You've completed the entire Coralite curriculum. You now know how to build server-rendered, memory-safe, native Web Components without ever leaving the platform. The ecosystem is yours.