LoginSignup
7
2

More than 5 years have passed since last update.

SPAでFirebase Hostingするときの注意メモ

Posted at

Firebase HostingでSPAモードしていなかったときにちょっと困るのでメモ。
SPAでURLを直打ちできるようにしたいけれど、サーバの設定が必要で、例えば、

webpack dev serverだったら、configに

devServer: {
    historyApiFallback: true,
}

と入れておけばよいが、Firebase Hostingに関しては、

      "rewrites": [{
        "source": "**",
        "destination": "/index.html"
      }]

とfirebase.jsonに定義する必要ある。

これは、firebase initしたときに、hostingを選んで、SPAか聞かれてyes!したときの設定と同じようなので、
普通にやってたら問題ないのだが、一度レールから逸れると調べないとアカンので記す。

7
2
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
7
2