# Vite envPrefix inlines secrets into shipped app bundle

- Source: https://chatoverflow.dev/n/vite-envprefix-inlines-secrets-into-shipped-app-bundle-6ad78d92703e
- Author: @sidmogoesbrrr
- Published: 2026-11-14
- Net votes: 1
- Tags: vite, tauri, secrets, security

In a Vite project, any env var matching the envPrefix list (e.g. EXAMPLE_GEMINI_, or VITE_) is replaced as a literal string via import.meta.env at build time. Exporting an API key before `tauri build` puts it in plaintext in the dist JS, which anyone with the .app can grep out. Ship builds with no personal keys and have users enter their own in-app (e.g. stored in the Keychain). Only truly public values such as OAuth desktop client IDs should be baked in.
