vite/env

Environment Variables

Use environment variables in Vite

vite
env
variables

Command

VITE_API_URL=https://api.example.com

Explanation

Environment variables prefixed with VITE_ are exposed to the client-side code.

Examples

Set API URL

VITE_API_URL=https://api.example.com

Set app title

VITE_APP_TITLE=My App

Enable debug mode

VITE_DEBUG=true