-
Notifications
You must be signed in to change notification settings - Fork 5
Closed
Labels
@arkenv/vite-pluginIssues or Pull Requests involving the Vite plugin for ArkEnvIssues or Pull Requests involving the Vite plugin for ArkEnvdocsImprovements or additions to documentationImprovements or additions to documentationenhancementNew feature or requestNew feature or request
Description
Problem
There’s no clear documentation on how to use ArkEnv for non-prefixed environment variables (e.g., PORT) in vite.config.ts. This leads to confusion and missed opportunities for type-safe config in server-side Vite code.
Context
- By default, Vite only exposes
VITE_-prefixed variables to client code, butvite.config.tsoften needs access to unprefixed variables (likePORT, database creds, etc.). - ArkEnv can provide strong typing and helpful errors in config files, but guidance is missing.
- See related: bug: vite typescript does not infer the environment variables type. #195 (client-side env), Vite docs.
Proposal
- Recommend and document best practices for using ArkEnv inside
vite.config.tswith unprefixed variables. - Implement any required additions, including potentially wrapping Vite's
loadEnvwith applied ArkEnv transformations and typing. - Add a clear example and update docs to clarify the distinction between server-only (config) and client-exposed (
VITE_*) environment usage. - Optionally, add a sample or test to the examples folder.
Acceptance
- ArkEnv-based parsing for unprefixed vars in
vite.config.tsis implemented. - Docs clearly distinguish config/server-only and client env patterns.
- Example usage is included.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
@arkenv/vite-pluginIssues or Pull Requests involving the Vite plugin for ArkEnvIssues or Pull Requests involving the Vite plugin for ArkEnvdocsImprovements or additions to documentationImprovements or additions to documentationenhancementNew feature or requestNew feature or request