Vite plugin to expose dynamic or non-prefixed environment variables via import.meta.env. Current stable version 1.0.2 (Aug 2023). Allows defining variables not starting with VITE_ (the default envPrefix) or process.env. Configurable to attach variables to import.meta.env or process.env. Different from standard Vite env handling by enabling arbitrary variable names without prefix restrictions. Active maintenance with TypeScript types included. Minimal API with one function call.
npm install vite-plugin-meta-envVerified import paths — ran on the pinned version, not inferred.
Shows how to define custom env variables without VITE_ prefix and access them via import.meta.env.
Rebuild the project after changing environment variable values. For dynamic runtime variables, use process.env with appropriate server-side handling.
Add declarations in a .d.ts file per Vite docs: https://vitejs.dev/guide/env-and-mode.html#intellisense
Only use 'import.meta.env' or 'process.env' as the second argument. Check that variable is accessible after configuration.
For SSR, use Vite's define option or platform-specific runtime config. The plugin is intended for client-side builds only.
Change to default import: import VitePluginMetaEnv from 'vite-plugin-meta-env'
Ensure plugin is added to Vite plugins array with correct arguments. Access via import.meta.env only after build.
Use default import syntax as shown in the docs.
No dependency data recorded yet.