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?

Nuxt.jsのWebページをfirebaseでホスティングする時の注意

Last updated at Posted at 2025-05-28

FireBase と Vue の連携ついて

FireBaseでデプロイしたものをホスティングするのに苦戦したのでまとめようと思います

ホスティングについて

ホスティングについて最初は何か分からなかったのですが簡単に言うとサーバを借りることだそうです。

今回のホスティングはFireBase を活用してNuxtjsで作成したプロジェクトをFireBaseのアカウントごとに作成できるWebページとしてインターネットに掲載出来るというものでした。

ホスティングするまでには大きく2つの工程がありました。

1. プロジェクトをビルド

npm run build

または

set NITRO_FIREBASE_GEN=2
npm nuxt generate

または

npx nuxt generate

色々と試しながらエラー起きながら気づいたら上手く行っていたのでちゃんとした正解は分からないですがこの3つのコマンドは試しました。

2. FireBaseのコマンドでデプロイを実行する

このコマンドでエラーが起きなければホスティングが成功ではあるのですが、最初はページが正しく表示されなくてあれ?となりました。

firebase deploy

3. FireBaseのホスティングの手順について

firebase.json

firebase.json
{
  "hosting": [
    {
      "target": "ホスティングの名前",
      "public": "dist",
      "ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
      "rewrites": [
        {
          "source": "**",
          "destination": "/index.html"
        }
      ]
    }
  ]
}
firebase deploy --only hosting:ホスティング先
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?