Make sure to use the same exact casing on the mode name when you use --mode. I ran vite with --mode "Development" when instead my file is .env.development