{"id":22649,"library":"vite-plugin-env-config","title":"vite-plugin-env-config","description":"Vite plugin that allows setting Vite config options via environment variables at build time. Current version 2.0.1, stable release cadence with occasional patches. Key differentiator: enables dynamic config overrides without modifying vite.config files, using a configurable prefix (default VITECONFIG_) and separator for nested object keys. Supports JSON-like value parsing with string fallback. Simple API, lightweight, TypeScript types included.","status":"active","version":"2.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/svitejs/vite-plugin-env-config","tags":["javascript","vite-plugin","vite plugin","vite","config","typescript"],"install":[{"cmd":"npm install vite-plugin-env-config","lang":"bash","label":"npm"},{"cmd":"yarn add vite-plugin-env-config","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-plugin-env-config","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only package; requires Node >=14.13.1","wrong":"const { envConfig } = require('vite-plugin-env-config')","symbol":"envConfig","correct":"import { envConfig } from 'vite-plugin-env-config'"}],"quickstart":{"code":"// vite.config.ts\nimport { defineConfig } from 'vite';\nimport { envConfig } from 'vite-plugin-env-config';\n\nexport default defineConfig({\n  plugins: [\n    envConfig({\n      prefix: 'VITECONFIG_',\n      separator: '_'\n    })\n  ]\n});\n\n// Then run:\n// VITECONFIG_build_minify=false vite build\n// This overrides build.minify to false","lang":"typescript","description":"Shows basic setup and usage with an example environment variable override"},"warnings":[{"fix":"Upgrade to Node 14.13.1 or later, or stay on v1.x if you must use Node 12","message":"Dropped support for Node 12 in v2.0.0","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Use JSON-compatible values: `true`, `false`, `\"string\"`, `123`. For string values that are not JSON, they remain strings.","message":"Value parsing uses JSON.parse; non-JSON values become strings. Booleans and numbers must be valid JSON (e.g., true, false, 42). Undefined/unquoted strings cause parse errors.","severity":"gotcha","affected_versions":"*"},{"fix":"Use a different approach for arrays (e.g., set as a JSON string and parse manually).","message":"Cannot set array items; only object properties are supported. Environment variable keys with numeric indices will be treated as object keys.","severity":"gotcha","affected_versions":"*"},{"fix":"Use single underscore for path separator. If a property name contains underscore, double it (e.g., `VITECONFIG_foo__bar=1` sets `{foo: {bar: 1}}`).","message":"Environment variable charset is limited to uppercase A-Z, underscore, and numbers. The prefix and property path must use underscore as separator; double underscore `__` is reserved for literal underscore in keys.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"npm install vite-plugin-env-config --save-dev (or pnpm/yarn equivalent)","cause":"Package not installed or not in dependencies","error":"Cannot find module 'vite-plugin-env-config'"},{"fix":"Check compatibility; currently v2.0.1 works with Vite 4.x. For Vite 5, look for an updated version or alternative plugin.","cause":"Plugin version may be outdated or not updated for Vite 5","error":"Error: The plugin 'vite-plugin-env-config' is not compatible with Vite 5"},{"fix":"Use named import: `import { envConfig } from 'vite-plugin-env-config'`","cause":"Possibly using a wrong import (default vs named).","error":"TypeError: envConfig is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}