Accepted answer

In .env.local you can set up environment variables that are specific to your local machine and it doesn't have to be on development mode to work, so variables there will work for both development and production.


Here's the priority of the files for the development build and the production build:

Dev.: (npm start): .env.development.local, .env.local, .env.development, .env

Prod.: (npm run build): .env.production.local, .env.local, .env.production, .env

If you ever want to use something in your local environment without being specific to the development build or the production build, you can add some variables to your .env.local file.

Source :

Related Query

More Query from same tag