Push React App to Github Pages

  • 安裝套件

    1
    2
    npm install gh-pages --save-dev
    yarn add -D gh-pages
  • 在 package.json 裡面新增

    1
    2
    3
    4
    5
    6
    7
    {
    "homepage" : "{url to your website}"
    "scripts": {
    "predeploy": "npm run build",
    "deploy": "gh-pages -d build"
    }
    }
  • 要 push 的時候就打以下指令,就可以自動 push 到 branch gh-pages

    1
    npm run deploy

Push React App to Github Pages
https://933yee.github.io/notes/2024/02/08/react-github-pages/
Author
Kevin Lee
Posted on
February 8, 2024
Licensed under