evidence preview command starts a local server to preview your production build.
Syntax
Description
This command:- Serves the production build from the
./builddirectory - Uses the
servepackage to start a static file server - Provides a local URL to preview your built application
- Automatically increases Node.js memory limit to 4096MB
- Supports both multi-page app (MPA) and single-page app (SPA) modes
Prerequisites
You must build your project before running preview:Usage Examples
Preview the production build
http://localhost:3000).
SPA mode preview
Error Handling
If no build directory is found, you’ll see:1
Server Options
The preview command uses theserve package under the hood. The exact command executed:
Multi-page app (default):
-s flag enables single-page application mode, which redirects all 404s to the root index.html.
Environment Variables
When set to
true, serves the build in SPA mode with client-side routing..env files automatically.
See Environment Variables for a complete list.
Port Configuration
Theserve package automatically selects an available port. You can specify a custom port using serve’s CLI options:
Exit Codes
0- Preview server started successfully1- No build directory found- Non-zero - Server failed to start
Build Directory
The preview command looks for the build in:Deployment Testing
The preview command is useful for testing:- Production build output
- Asset loading and paths
- Static file serving
- Routing behavior
- Performance characteristics
Related Commands
- evidence build - Build production outputs (required before preview)
- evidence dev - Development server with hot reloading