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.
vantris build && vantris preview # → http://localhost:4173What it does
- Serves static files with correct content types.
- Applies the SPA fallback to
index.htmlfor 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
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
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:
outDirdoesn't exist → "runbuildfirst".- The port is in use → an address-in-use error.
Preview vs. Dev
vantris dev | vantris preview | |
|---|---|---|
| Compiles source | ✅ on the fly | ❌ never |
| HMR | ✅ | ❌ |
| Serves | rootDir + public/ | outDir |
| Default port | 3000 | 4173 |
| Mirrors production | no | yes |
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.