What Is the Difference Between. Env. Local And. Env. Development. Local?
I Used a Create-React-App. and Created Environment Variable Files. .Env. Local, .Env. Development. Local I Found That. Env. Development Ispreferred Over. Env...
I used a create-react-app.
And created environment variable files. .env.local, .env.development.local
I found that .env.development ispreferred over .env.local
And env.development.local seems to have prioty over .env.development.
If so, .env.development.local is used to override .env.development what is the purpose of .env.local?
2 Answers
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 :
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.