0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

React deploy to github static pages

Posted at

githubに静的ページをdeployする方法

install the gh-pages

npm i gh-pages

package.jsonを開き、scriptsに以下のdeployの内容を追記
image.png

"scripts":{ ...,
    "deploy": " gh-pages -d build",
    "predeploy": "npm run build"
}
"homepage": "https://{githubのuser-name}.github.io/{project名}"

※pre-がついていたら、該当するコマンドが動く先にpre-コマンドが動く、後コマンドが動く
※project名は git remote -v で検索する。
※該当するhomepageがpublishedされる先

projectをbuildするため、以下のコマンドを叩く

npm run build

build後以下のようにbuildフォルダーが作成されることを確認する
image.png

buildされたものを配布する(deploy)

npm run deploy

実行後以下のようにpublishedが出力されたら、OK
image.png

明示されたhomepageに入ったら、配布されたことが確認できる

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?