Skip to content

ultimateakash/react-multiple-env

Repository files navigation

Create Multiple Environments In React

.env files

 .env.development
 .env.staging 
 .env.production 

package.json

"scripts": {
    "start": "env-cmd -f .env.development react-scripts start",
    "start:staging": "env-cmd -f .env.staging react-scripts start",
    "start:production": "env-cmd -f .env.production react-scripts start",
    "build": "env-cmd -f .env.development react-scripts build",
    "build:staging": "env-cmd -f .env.staging react-scripts build",
    "build:production": "env-cmd -f .env.production react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
},

development

npm start
npm build

staging

npm run start:staging
npm run build:staging

production

npm run start:production
npm run build:production

Releases

No releases published

Packages

No packages published