Filesystem
Exports from the @vlandoss/env/fs entrypoint — file-based config loading for any Node-compatible runtime with a filesystem.
The @vlandoss/env/fs entrypoint is the file-system adapter. It auto-discovers per-environment config files on disk so you don't have to wire imports by hand.
Works on any runtime that exposes a Node-compatible filesystem: Node ≥22.12 (≥22.18 for .ts/.mts/.cts configs), Bun, and Deno (via its Node-compat layer). It does not work on Workers, Edge, or any environment without a filesystem — those should resolve config at build time (see @vlandoss/env/vite) or pass it explicitly to defineEnv.
Exports
| Export | Kind | Summary |
|---|---|---|
loadConfig | Function | Synchronously discover and load [src/]config/<envName>.{ts,mts,cts,js,mjs,cjs,json} for the current env. Returns Config<S> directly (loads via require()), so it works in app code and in config files that tooling loads synchronously. Accepts an optional pattern (template) and cwd (override process.cwd()). |
Full signatures and option tables are coming soon. Until then, see
Guides → Filesystem (loadConfig) for the recipe.
loadConfig loads files with require(). Runtime requirements by extension:
.ts/.mts/.cts— needs native TypeScript stripping (native in Bun and Deno, Node ≥22.18)..mjs/.js/.cjs— needsrequire(esm)(native in Bun/Deno, Node ≥22.12)..json— works on any supported Node.
Module loads are cached by the host's module system: editing a .ts/.mjs/.cjs config in a long-running process won't be picked up until restart. .json files are re-read on every call.
See also
- Guides → Filesystem (
loadConfig) — recipe and tradeoffs. - Concepts → Resolution order — where loaded config sits in the merge order.
Core
Exports from the @vlandoss/env entrypoint — the runtime-agnostic core where schemas are declared, env is resolved, and the current environment name is detected.
Vite
Exports from the @vlandoss/env/vite entrypoint — the Vite plugin that aliases per-environment config and injects the build's env name.