Vite · types
VITE0011Type Vite environment variables
Flags untyped env in Vite env code before it leaks into runtime behavior.
vite-doctor/vitetypeswarnNo fix
Why it happens
Runtime configuration has different server and client visibility. Using the framework API keeps environment data typed and scoped.
Fix
Remove untyped env, or move it to the Vite runtime/API that owns that behavior.
Example
Type import.meta.env access
Before
const apiBase = import.meta.env.VITE_API_BASE
After
interface ImportMetaEnv {
readonly VITE_API_BASE: string
}
const apiBase = import.meta.env.VITE_API_BASE
Verify the fix
Run only this rule after editing so the report stays focused on the diagnostic you are closing:
pnpm vite-doctor . --framework vite --extends auto,vite/strict --rules vite/env/no-untyped-env