A Vite plugin that injects custom environment variables into the client bundle via import.meta.env. Current stable version is 1.0.1, released with no documented release cadence. It differentiates from Vite's built-in env handling by allowing custom variables defined directly in the Vite config, rather than relying on .env files or process.env. Supports TypeScript types but its API surface is minimal. Caution: The README example contains a typo referencing 'vite-plugin-stachtml' which will cause import errors.
npm install vite-plugin-envVerified import paths — ran on the pinned version, not inferred.
Shows how to use the env plugin to inject custom variables into import.meta.env, including a fallback for secrets via process.env.
Replace import { env } from 'vite-plugin-stachtml' with import { env } from 'vite-plugin-env'.Ensure env({ ... }) returns a valid Vite plugin object.Use process.env for server-side variables or define plugin for universal values.
Use uppercase variable names (e.g., MY_VAR).
Ensure you call env({ ... }) and import { env } from 'vite-plugin-env'.Add MY_VAR to the env({...}) object with a default value.Run npm install vite-plugin-env --save-dev
No dependency data recorded yet.