www.digitalmars.com .env.development.local   .env.development.local   .env.development.local   .env.development.local   C & C++   DMDScript  .env.development.local .env.development.local .env.development.local

.env.development.local

Imagine a team of five developers. Everyone checks out the same repo.

Because .env.development.local is in .gitignore, Alice and Bob never overwrite each other’s configurations, yet they both inherit the base .env.development settings.

.env.development (committed): REACT_APP_API_URL=https://staging-api.example.com FEATURE_X=false .env.development.local

.env.development.local (gitignored): REACT_APP_API_URL=http://localhost:5000 LOCAL_DB_URL=postgres://dev:password@localhost:5432/devdb FEATURE_X=true

It is a configuration file used to store environment variables specifically for your local development machine. Imagine a team of five developers

It is part of a naming convention popularized by tools like Create React App, Vite, Next.js, and Vue CLI. The file is designed to override other environment files without being committed to your version control system (like Git).

When you start a new project (using Create React App, Vite, or dotenv in Node.js), the first thing you usually do is create a .env file in the root directory. This file works. But it has two major flaws: Because

To solve this, framework authors invented file hierarchy and mode-specific files.

Why would you need such a specific file? Here are three compelling scenarios:

# .env.production.local (Ignored)
NODE_OPTIONS="--inspect"
LOG_LEVEL="debug"

Run your production build locally with debugging enabled, without altering the production config.