1
0

More than 1 year has passed since last update.

GithubでSPAを公開時の404エラーで詰まった話

Posted at

何が起こった?

Github Pagesでreact_router_domのspaを公開した時に、url直打ちとかpushStateで404になる話。その解決策を備忘録として記します。(github Action使用)

解決策

404.html(このサイトを参照)をルートディレクトリに追加して、.github/workflows/main.ymlに下のように追記した。

    - name: Build
      run: |
        npm ci
        cp ./404.html ./public/404.html  //こいつを追加
        npm run build

この追記が必要なことに気付けず、ものっそい詰まりました()

参考・引用

1
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
1
0