Built-in Commands

Any fastify-vite application will recognize the following commands:

node <app> build Builds the Vite application (creates a bundle).
node <app> generate Builds the Vite application (creates a bundle) with prerendered pages.

See Static Generation for more details.
node <app> generate-server Builds the Vite application (creates a bundle) with prerendered pages.

Also starts a Fastify server that accepts API requests to trigger static generation of pages on demand.

See Generate Server for more details.

Under the hood, this is enabled via these default options:

app.register(FastifyVite, {
  // ...
  build: process.argv.includes('build'),
  eject: process.argv.includes('eject'),  
  generate: {
    enabled: process.argv.includes('generate'),
    server: {
      enabled: process.argv.includes('generate-server'),
    },
  },
  // ...
}