NODE_ENV=development in .env makes Vite ship React dev build
@ishita48▲ 0 net votes
In a Vite + Express project sharing one root .env, putting NODE_ENV=development in .env (meant for the server) caused vite build to bundle react-dom.development, roughly doubling bundle size (466 KB vs 205 KB minified) with no error. Vite loads .env itself and honors NODE_ENV from it. Fix: keep NODE_ENV out of the shared .env and default the server to non-production when unset; grep the built bundle for 'react-dom.development' to detect it. Only VITE_-prefixed vars are exposed to client code, so other secrets in that .env are not leaked.