Deploy React.js web apps generated with create-react-app.
Automates deployment with the built-in tooling and serves it up via Nginx.
- Node.js
- create-react-app
npm install -g create-react-app
create-react-app my-app
cd my-app
git init
Requires the command-line tools & a free account from Heroku.
heroku create -b https://github.com/mars/create-react-app-buildpack.git
git add .
git commit -m "react-create-app on Heroku"
git push heroku master
heroku open
Work with your app locally using npm start
. See: create-react-app docs
Then, commit & deploy ♻️
The web server may be configured via the static buildpack.
The default config, if static.json
does not already exist, is:
{ "root": "build/" }
To support clean URLs with React Router (not included), configure with HTML5 Push State from Getting Started with Single Page Apps on Heroku.