Vite plugin to use varlock for .env file loading - adds validation, type-safety, and extra security features
npm install @varlock/vite-integrationThis package helps you integrate varlock into a Vite-powered project.
It is designed as a Vite plugin, which will override Vite's default .env file loading logic, and instead use varlock.
Compared to the default Vite behavior, this package provides:
- validation of your env vars against your .env.schema
- type-generation and type-safe env var access with built-in docs
- redaction of sensitive from logs during build time
- more flexible multi-env handling, rather than relying on the --mode flag
See our docs site for complete installation and usage instructions.
Some web frameworks use Vite and have their own plugins to enable very complex client/server hybrid rendering, or complex build processes. This plugin is designed to work with simple vanilla Vite projects, and complex framework powered projects. While this plugin should work with most frameworks, so far it has specifically been tested with:
- React Router
- Qwik
- Cloudflare Workers
- Astro* (please use the Astro integration)