Environment
Creating env variables
- Create a
.env.localfile 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.tsfile, 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;
}