-
Replace the
homepagefield inpackage.jsonwith:"homepage": "https://.github.io/"
For example, if your username is
andrewreevesand your repo isHigh-Imperial-Translator:"homepage": "https://andrewreeves.github.io/High-Imperial-Translator"
-
Install the
gh-pagespackage:npm install --save-dev gh-pages
-
Add the following scripts to your
package.json:"predeploy": "npm run build", "deploy": "gh-pages -d build"
-
Commit your changes, then deploy with:
npm run deploy
-
Make sure your repository's GitHub Pages settings are set to deploy from the
gh-pagesbranch.
These steps will allow you to build and deploy your React app to GitHub Pages.
- Update the
homepagefield inpackage.jsonto your GitHub Pages URL. - Run
npm run buildto build the app and copy it to thedocsfolder. - Commit and push the
docsfolder to your repository's default branch. - Enable GitHub Pages in your repository settings, set the source to
/docs. - A
.nojekyllfile is included to prevent Jekyll processing.
You can also use npm run deploy to commit and push the docs folder.