`environment` properties are not loaded into Vite Preview commands
Author: taylorfsteeleCreated May 18, 2026Updated Aug 28, 2026
In Vite components like React and TanStackStart, client environment variables are added to the vite build command by loading them into process.env, and are available locally when running sst dev. They're not available in the vite preview command. Normally no problem, just add sst shell to the preview command. But when the build command spawns a preview command, that process doesn't have the client environment variables.
Is it possible to add these environment properties to the vite preview commands by loading them into process.env similarly to how they're loaded in for the build command? Is that even a good idea?
Source: anomalyco/sst