Note: this feature is available with [email protected] and higher.
.env
: Default..env.local
: Local overrides. This file is loaded for all environments except test..env.development
,.env.test
,.env.production
: Environment-specific settings..env.development.local
,.env.test.local
,.env.production.local
: Local overrides of environment-specific settings.
npm start
:.env.development.local
,.env.local
,.env.development
,.env
npm run build
:.env.production.local
,.env.local
,.env.production
,.env
npm test
:.env.test.local
,.env.test
,.env
(note.env.local
is missing)
These variables will act as the defaults if the machine does not explicitly set them. Please refer to the dotenv documentation for more details.
Haha sure, I can update it. I made this for personal reference in 2019 and haven't used CRA in a very long time, but I guess it's bad to leave bad info out there. Granted, it was correct when I originally made this.
Create react app is not the recommended way to start new react projects anymore by the way. They don't even recommend it in the "Start a New React Project" section of their official docs anymore: https://react.dev/learn/start-a-new-react-project
The closest direct alternative to CRA that comes highly recommended from the community is vite: https://vitejs.dev/guide/#scaffolding-your-first-vite-project