Closed pratikkabade closed 2 years ago
In here
Install the gh-pages npm package
gh-pages
npm install gh-pages --save-dev
Add a homepage property to the package.json file
homepage
package.json
{ "name": "my-app", "version": "0.1.0", + "homepage": "https://userName.github.io/repositoryName", "private": true,
Add a predeploy property and a deploy property to the scripts object:
predeploy
deploy
scripts
"scripts": { + "predeploy": "npm run build", + "deploy": "gh-pages -d build", "start": "react-scripts start", "build": "react-scripts build",
Deploy the React app to GitHub Pages
npm run deploy
Publish React project to GitHub Pages
In here
Content
Install the
gh-pages
npm packagenpm install gh-pages --save-dev
Add a
homepage
property to thepackage.json
fileAdd a
predeploy
property and adeploy
property to thescripts
object:Deploy the React app to GitHub Pages
npm run deploy