Read this and you'll be able to: load the same .env into both a Vite frontend and a Node/Express backend without two copies, stop import.meta.env.VITE_API_URL from silently becoming undefined in production, and prove which variables actually shipped to the browser using a 5-line build check. Every snippet below runs as-is on Vite 5/6 and Node 20+.

The reason .env wrecks half a day isn't that it's hard — it's that Vite and Node read environment variables through two completely different mechanisms that look identical in code. Once you see the split, the bugs become obvious.

The split nobody tells you: Vite's import.meta.env is a build-time string swap, Node's process.env is a runtime lookup

Here is the single fact that fixes 80% of these issues:

Node reads process.env.FOO when the process starts. Change the value, restart, done.