Skip to content

Preview

vantris preview serves the finished production build from outDir exactly as produced — no compilation. It's the closest local mirror of production, useful to sanity-check a build before deploying.

bash
vantris build && vantris preview   # → http://localhost:4173

What it does

  • Serves static files with correct content types.
  • Applies the SPA fallback to index.html for client-side routes.
  • Prints both Local and Network URLs on start.
  • Optionally opens the browser with open: true.

Because it does no transformation, it can only serve what vantris build already wrote — it's a static file server pointed at outDir, with the same SPA fallback the dev server uses.

Configuration

ts
import { defineConfig } from "vantris";

export default defineConfig({
  preview: {
    port: 4173,       // default
    host: "localhost", // default
    open: false,       // open the browser on start; default false
  },
});

See Preview Options for the full reference.

Opening the browser automatically

ts
export default defineConfig({
  preview: { open: true },
});

Launches the default browser on macOS, Windows, and Linux when the server is ready.

Fails fast

vantris preview gives you a clear error instead of a confusing one when:

  • outDir doesn't exist → "run build first".
  • The port is in use → an address-in-use error.

Preview vs. Dev

vantris devvantris preview
Compiles source✅ on the fly❌ never
HMR
ServesrootDir + public/outDir
Default port30004173
Mirrors productionnoyes

Use dev while building features; use preview to verify the actual artifact you're about to ship — including hashed filenames, minification, and the base-prefixed URLs that only exist after a build.

Preview vs. a real server

preview is a convenience, not a production server. Deploy the contents of outDir to your host of choice (static hosting, a CDN, an nginx root). If you build with a base sub-path, make sure your host serves the app under that same path.

Released under the MIT License.