You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#### Add `env.ts` transform for Vite fullstack apps
6
+
7
+
Let the Vite plugin discover your `env.ts` and expose a shared `env` object that works in both client and server code. On the client, public (`VITE_*`) values are inlined at build time and server-only keys throw if read; on the server/SSR, `env.ts` still runs normally and validates against the real environment at boot. The plugin does not rewrite your `env.ts` file on disk.
8
+
9
+
Works with `@arkenv/vite-plugin` and `@arkenv/vite-plugin/standard`.
10
+
11
+
Usage:
12
+
13
+
```ts
14
+
// vite.config.ts
15
+
importarkenvfrom"@arkenv/vite-plugin";
16
+
17
+
exportdefault {
18
+
plugins: [arkenv()], // finds src/env.ts or env.ts
This example demonstrates how to use [@arkenv/vite-plugin](https://arkenv.js.org/docs/vite-plugin) with [SolidStart](https://start.solidjs.com). It showcases:
3
+
This example demonstrates `@arkenv/vite-plugin` with [SolidStart](https://start.solidjs.com):
4
4
5
-
-**Environment variable validation** at build-time with ArkEnv
6
-
-**Typesafe `import.meta.env`** with full TypeScript support
7
-
-**Client-side environment variables** with automatic filtering of `VITE_*` prefixed variables
5
+
- A single `src/env.ts` is the typed source of truth (`import { env } from "./env"`)
The example includes type augmentation for `import.meta.env` in `src/global.d.ts`. This ensures correct TypeScript inference for all variables defined in your schema.
0 commit comments