Can anyone tell me how to use environment variables for different environments within T3 please?
I have .env which is working fine. I want to use .env.development for when I dev and .env.product when I've built and deployed.
I can't see anywhere where this can be set, I can see using this the variables don't switch as I expect and simply just default to .env. I've attempted to follow the Next docs to no avail.
Am I missing something somewhere?
1 Reply
Next loads
.env.development
and .env.production
automatically, you don't need to configure everything
https://nextjs.org/docs/app/building-your-application/configuring/environment-variables#environment-variable-load-orderConfiguring: Environment Variables | Next.js
Learn to add and access environment variables in your Next.js application.