Skip to content

Preview Options

The preview block configures the preview server (vantris preview), which serves a finished build from outDir with no compilation. See the Preview guide.

ts
import { defineConfig } from "vantris";

export default defineConfig({
  preview: {
    port: 4173,
    host: "localhost",
    open: false,
  },
});

preview.port

  • Type: number
  • Default: 4173

Port the preview server listens on. If it's already in use, vantris preview fails fast with a clear error.

ts
export default defineConfig({ preview: { port: 8080 } });

preview.host

  • Type: string
  • Default: "localhost"

Host the preview server binds to. Bind to 0.0.0.0 to expose it on your network; both a Local and a Network URL are printed on start.

ts
export default defineConfig({ preview: { host: "0.0.0.0" } });

preview.open

  • Type: boolean
  • Default: false

Open the app in the default browser once the server is ready — macOS, Windows, and Linux.

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

Notes

  • The preview server serves outDir. If it doesn't exist, you get a clear "run build first" error.
  • It applies the same SPA history fallback as the dev server, so client-side routes work on refresh.
  • preview is separate from dev: each server has its own host/port.

PreviewConfig at a glance

ts
interface PreviewConfig {
  port?: number;   // default 4173
  host?: string;   // default "localhost"
  open?: boolean;  // default false
}

Released under the MIT License.