Skip to content

Instantly share code, notes, and snippets.

@vre2h
Last active November 8, 2024 13:45
Show Gist options
  • Save vre2h/da9db3733c238c174d13670fb77c1f1a to your computer and use it in GitHub Desktop.
Save vre2h/da9db3733c238c174d13670fb77c1f1a to your computer and use it in GitHub Desktop.
Simple guide for deploying your react app to Github-Pages.
  1. Your package.json file should consist a field homepage:
  "homepage": "https://<github-username>.github.io/<project-repo>"

2.1. Install gh-pages via npm:

  npm i --save-dev gh-pages

2.2. Or yarn:

  yarn add --dev gh-pages

3.1. Add new script to package.json via yarn:

    "predeploy": "yarn run build",
    "deploy": "gh-pages -d build"

3.2. Or npm:

    "predeploy": "npm run build",
    "deploy": "gh-pages -d build"
@CCBoss09
Copy link

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment