{"id":26602,"library":"vite-plugin-valibot-env","title":"vite-plugin-valibot-env","description":"A Vite plugin that validates environment variables against a Valibot schema at build time. Current stable version is 1.0.2, released with support for Vite 8 stable. Released under MIT license. Key differentiators: integrates Valibot's modular and lightweight schema validation, supports optional prefix stripping, value transformation (boolean, integer, float, null), localized error messages via @valibot/i18n, and callback hooks for custom issue handling. Requires Node.js 20+ and Valibot 1.0.0+. Alternative to similar plugins using Zod or Joi, offering tree-shakeable validators.","status":"active","version":"1.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/idleberg/vite-plugin-valibot-env","tags":["javascript","vite-plugin","valibot","typescript"],"install":[{"cmd":"npm install vite-plugin-valibot-env","lang":"bash","label":"npm"},{"cmd":"yarn add vite-plugin-valibot-env","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-plugin-valibot-env","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Runtime dependency for schema validation","package":"valibot","optional":false},{"reason":"Peer dependency — the plugin is a Vite plugin","package":"vite","optional":true}],"imports":[{"note":"Default export, not named. Use default import.","wrong":"import { valibot } from 'vite-plugin-valibot-env'","symbol":"valibotEnv (default)","correct":"import valibot from 'vite-plugin-valibot-env'"},{"note":"CommonJS require requires `.default` because the package is ESM-first; CJS via bundler fallback.","wrong":"const valibot = require('vite-plugin-valibot-env')","symbol":"valibotEnv (require)","correct":"const valibot = require('vite-plugin-valibot-env').default"},{"note":"Type import for options object; only available if you need the exact type.","wrong":"","symbol":"type Config (TypeScript)","correct":"import type { Config } from 'vite-plugin-valibot-env'"}],"quickstart":{"code":"import { defineConfig } from 'vite';\nimport * as v from 'valibot';\nimport valibotEnv from 'vite-plugin-valibot-env';\n\nconst envSchema = v.object({\n  VITE_API_URL: v.pipe(v.string(), v.url()),\n  VITE_PORT: v.pipe(v.string(), v.transform(Number)),\n  VITE_DEBUG: v.optional(v.pipe(v.string(), v.transform((s) => s === 'true'))),\n});\n\nexport default defineConfig({\n  plugins: [\n    valibotEnv(envSchema, {\n      ignoreEnvPrefix: false,\n      transformValues: true,\n    }),\n  ],\n});","lang":"typescript","description":"Validates environment variables against a Valibot schema, with value transformation and prefix handling."},"warnings":[{"fix":"Update Valibot to 1.0.0 or later; adjust schema syntax if needed (Valibot 1.0 breaking changes).","message":"In version 0.10.0, the peer dependency requirement changed from valibot <1.0.0 to >=1.0.0. Valibot 0.x schemas are incompatible.","severity":"breaking","affected_versions":">=0.10.0"},{"fix":"Use default import: `import valibot from 'vite-plugin-valibot-env'`.","message":"The default export is the plugin function, not an object with a named export. Attempting `import { valibot }` will result in `undefined`.","severity":"gotcha","affected_versions":">=0.9.0"},{"fix":"Use `const valibot = require('vite-plugin-valibot-env').default`.","message":"When using CommonJS require (e.g., in a Node.js environment), you must use `.default` because the package is ESM-first and bundled as CJS with an export default.","severity":"gotcha","affected_versions":">=0.9.0"},{"fix":"Monitor changelog for migration; currently still supported.","message":"The `onBeforeIssues` and `onAfterIssues` callbacks are available but may be removed in future releases in favor of a unified event system.","severity":"deprecated","affected_versions":">=0.9.0"},{"fix":"Install `@valibot/i18n`, then import it in your vite.config file before using the language option.","message":"When using `language` option, you must install `@valibot/i18n` separately and import it in your Vite config. The plugin does not automatically bundle i18n.","severity":"gotcha","affected_versions":">=0.9.0"}],"env_vars":null,"search_vec":"'1.0.0':73 '1.0.2':24 '20':70 '8':30 'altern':74 'boolean':52 'build':18 'callback':62 'current':20 'custom':65 'differenti':37 'env':5 'environ':11 'error':57 'float':54 'handl':67 'hook':63 'integ':53 'integr':38 'issu':66 'javascript':87 'joi':81 'key':36 'licens':35 'lightweight':43 'local':56 'messag':58 'mit':34 'modular':41 'node.js':69 'null':55 'offer':82 'option':47 'plugin':3,8,77,90 'prefix':48 'releas':25,32 'requir':68 'schema':16,44 'shakeabl':85 'similar':76 'stabl':21,31 'strip':49 'support':27,46 'time':19 'transform':51 'tree':84 'tree-shak':83 'typescript':92 'use':78 'valibot':4,15,39,72,91 'valibot/i18n':60 'valid':10,45,86 'valu':50 'variabl':12 'version':22 'via':59 'vite':2,7,29,89 'vite-plugin':88 'vite-plugin-valibot-env':1 'zod':79","created_at":"2026-05-01T13:50:49.835460+00:00","updated_at":"2026-05-01T13:50:49.835460+00:00","problems":[{"fix":"Change to `import valibot from 'vite-plugin-valibot-env'`.","cause":"Using named import `import { valibot } from 'vite-plugin-valibot-env'` instead of default import.","error":"TypeError: valibot is not a function"},{"fix":"Run `npm install vite-plugin-valibot-env valibot` or `deno add jsr:@idleberg/vite-plugin-valibot-env valibot`.","cause":"Package not installed or not in node_modules.","error":"Error: Cannot find module 'vite-plugin-valibot-env'"},{"fix":"Install `@valibot/i18n` with your package manager.","cause":"Missing `@valibot/i18n` peer dependency when using language option.","error":"The plugin options 'language' require '@valibot/i18n' installed."},{"fix":"Upgrade valibot to ^1.0.0 and adjust schema syntax.","cause":"Using an older version of valibot (0.x) with vite-plugin-valibot-env >=0.10.0.","error":"Error: Valibot schema version mismatch. Expected >=1.0.0 but got 0.x"}],"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/idleberg/vite-plugin-valibot-env","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/vite-plugin-valibot-env","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-05-01","next_check":"2026-07-30","install_tag":null}}