Vite Build

Before you can deploy to production, you need to bundle your code through Vite.

To be more specific, you need to bundle your client and server entry points.

In a vanilla Vite app, that means having to run two build commands:

vite build --ssrManifest --outDir dist/client
vite build --ssr entry/server.js --outDir dist/server

Check out Vite's SSR Guide for in-depth details.

In fastify-vite apps, you can just use the build command that is added to the app automatically:

node <app> build

This command will use Vite's API to trigger the builds for both client and server bundles, and prevent the Fastify server from starting. See Built-in Commands for more details.