
Next.js Loads .env.local During Production Builds - And It Overrides .env.production
A production build baked http://localhost:5080 into the live bundle. The cause was a .env.local file that Next.js loads during next build and ranks above .env.production. Here is the precedence order, a ten-line way to prove it on your own project, and the rename that fixes it permanently.
7 min read

