I have a standard React app that is using ViteJS.
I want to deploy my app to different environments:
- Dev
- Test
- Staging
- Production
I already have .env files for each of those environments:
- .env.localhost
- .env.dev
- .env.test
- .env.staging
- .env.prod
Do you know what I need to do in order to make sure that the appropriate file is being loaded when I deploy the app on each environment ?
I was experimenting on localhost (windows) by setting those two Environment Variables, but I cannot make it work so far:
- NODE_ENV: staging
- ENV: staging
How are you doing this ? How do you load different configurations for different environments ?