맨날 배포를 해도 까먹으니 포스팅을 해야겠다.
터미널에
npm i gh-pages
명령어로 깃허브 페이지를 다운받는다.
package.json 파일에서
script를 찾는다
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"deploy": "gh-pages -d build",
"predeploy": "npm run build"
},
이렇게 만들어 준다.
package.json 파일에 "hompage"를 추가해준다.
"homepage": "https://${깃허브 유저네임}.github.io/${레포네임}"
이제 터미널에 아래 명령어를 입력하면 된다.
npm run deploy
index.html에 원래 있는 manifest부분을 아래의 것으로 바꿔주자
rel이 "manifest"인것을 "/"를 추가한것이다.
<link rel="/manifest" href="/manifest.json" crossorigin="use-credentials" />
hompage에서 맨뒤에 /를 추가하자
"homepage": "https://${깃허브 유저네임}.github.io/${레포네임}/"