React - host in GitHub
In these months I'm playing with React, Redux and ES6.
I fell in love with the Meteor ecosystem some year ago, and one of the things I appreciated a lot, was the ability to easily deploy the project online.
I was happy to find a way to deploy the project in a similar way with React application created with create-react-app
.
Here's how:
-
Add an
homepage
field in yourpackage.json
"homepage": "https://myusername.github.io/my-app"
-
Install gh-pages
yarn add gh-page
-
Add the
deploy
to your command, inpackage.json
"scripts": { "predeploy": "npm run build", "deploy": "gh-pages -d build", ...
-
Deploy:
yarn deploy
PS. Be sure to have the GitHub Pages are enabled in your
GitHub settings
References:
create-react-app in GitHub