dailylog 7-12-20

less than 1 minute read

How to host react app on Github pages

Reference

  1. Download gh-pages
yarn add gh-pages
  1. Add homepage to package.json
"homepage": "https://aaroncaraway.github.io/umre-todo/"
  1. Update scripts section of package.json to include predeploy and deploy
"scripts": {
    "start": "react-scripts start",
    "predeploy": "yarn build",
    "deploy": "gh-pages -d build",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
},
  1. !! IMPORTANT !! Run yarn deploy

  2. In project repo on github, go to settings and host pages from gh-pages branch