[ react-scripts ] deployment

package.json

"start": "react-scripts start",
"start:production": "node -r dotenv/config ./node_modules/.bin/react-scripts start dotenv_config_path=.env.production",
"build": "react-scripts build",
"build:development": "node -r dotenv/config ./node_modules/.bin/react-scripts build dotenv_config_path=.env.development"

NOTE :

  • default `react-scripts start` reads .env.development
  • default `react-scripts build` reads .env.production

use serve as a static server ( production )

react-scripts build
yarn global add serve
serve -s build -p 3000

which serve

yarn global bin
/home/pong/.yarn/bin

ref : https://github.com/tuchk4/react-app-env/blob/master/README.md

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s