Skip to main content

Environment

Creating env variables

  • Create a .env.local file in the root of your project:
VITE_APP_KEY=<your-app-name>

Note: Every env variable should be prefixed with VITE_

Types for env variables

  • In vite-env.d.ts file, add the types for your variables:
/// <reference types="vite/client" />

interface ImportMetaEnv {
readonly VITE_ENV: "dev" | "prod";
readonly VITE_APP_KEY: string;
}

interface ImportMeta {
readonly env: ImportMetaEnv;
}