{"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,"search_vec":"'2.0.1':22 'allow':9 'api':61 'build':18 'cadenc':25 'config':5,12,33,73 'configur':41 'current':20 'default':43 'differenti':30 'dynam':32 'enabl':31 'env':4 'environ':15 'fallback':59 'file':38 'includ':65 'javascript':66 'json':53 'json-lik':52 'key':29,50 'lightweight':62 'like':54 'modifi':36 'nest':48 'object':49 'occasion':27 'option':13 'overrid':34 'pars':56 'patch':28 'plugin':3,7,69,71 'prefix':42 'releas':24 'separ':46 'set':10 'simpl':60 'stabl':23 'string':58 'support':51 'time':19 'type':64 'typescript':63,74 'use':39 'valu':55 'variabl':16 'version':21 'via':14 'vite':2,6,11,68,70,72 'vite-plugin':67 'vite-plugin-env-config':1 'vite.config':37 'viteconfig':44 'without':35","created_at":"2026-04-27T17:06:17.909081+00:00","updated_at":"2026-04-27T17:06:17.909081+00:00","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,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/svitejs/vite-plugin-env-config","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/vite-plugin-env-config","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops","web-framework"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-18","next_check":"2026-07-26","install_tag":null}}