github 배포하기

당근 싫어하는 사람·2023년 7월 12일

gh-pages

npm i gh-pages 
or 
yarn add gh-pages

package.json 수정

// scripts 부분 수정
"scripts": {
  "start": "react-scripts start",
  "build": "react-scripts build",
  "test": "react-scripts test",
  "eject": "react-scripts eject",
  "deploy": "gh-pages -d build",	              // deploy 명령어 실행 시 먼저 predeploy 명령어를 실행
  "predeploy": "npm run build" 또는 "yarn build"   // 1. build 후 deploy 순으로 실행됨
}

// 최하단 homepage 추가
"homepage": "https://purplemm.github.io/repogitory명"

배포하기

npm run deploy
or
yarn deploy

github 해당 repogitory의 setting > Pages의 Branch 설정

profile
기억 못하니까 기록해야지?

0개의 댓글