자신의 프로젝트 루트 경로에 파일을 생성
.env.local
.env.production
.env.test
.env.dev
.env.development
... 등등

package.json에 있는 scripts를 보면, 자신이 생성한 환경 변수에 따라 빌드 할 수 있습니다.

{
"scripts": {
"start": "cross-env NODE_ENV=development dotenv -e .env.development -e .env -- react-scripts start",
"build": "cross-env NODE_ENV=production dotenv -e .env.production -e .env.development -- react-scripts build",
"test": "cross-env NODE_ENV=test dotenv -e .env.test -e .env -- react-scripts test"
},
"devDependencies": {
"cross-env": "^7.0.3",
"dotenv-cli": "^7.0.0"
}
}
또다른 예
"start": "export PORT=8888 && env-cmd -f .env.local react-scripts start",
"build": "env-cmd -f .env.dev react-scripts build",