An esbuild plugin that validates environment variables against a Valibot schema during the build process. Current stable version is 0.6.1 (released 2024). It allows catching misconfigured environment variables early by integrating schema validation into esbuild's plugin system. Key differentiator: uses Valibot's modular and tiny validation library instead of Zod or Joi, making it ideal for frontend builds. Requires esbuild 0.20–0.26 and Valibot ^1.0.0. Supports dotenv files, localized error messages, and optional value transformation.
npm install esbuild-plugin-valibot-envNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic integration: defines a Valibot schema, passes it to the plugin, and runs esbuild build.
Upgrade valibot to ^1.0.0.
Install esbuild version between 0.20 and 0.26 inclusive.
Specify a valid .env file path or ensure environment variables are set otherwise.
Set transformValues: true if you need automatic parsing; otherwise handle type conversions manually in schema.
If using Vite, consider using vite-plugin-valibot-env instead.
Run: npm install -D esbuild-plugin-valibot-env
Ensure you are passing the function result directly: plugins: [valibotPlugin(schema)] not plugins: [valibotPlugin]
Upgrade valibot to v1: npm install valibot@^1.0.0
Check your .env file or actual environment variables and ensure they match the schema (e.g., correct types, urls, literals).