1
1

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.

IonicをFirebaseでホスティングする

Last updated at Posted at 2020-01-25

Angularをfirebaseでホスティングした記事はありましたが、Ionicの例はなく、試すまでできるかどうかわからなかったので投稿します。特に目新しい内容はありませんが、AungularでやるようにすればIonicでもできたということを伝えるための記事です。(firebas.jsonの書き換えは必要ではまりました)

→[Angularの場合][1]
[1]:https://qiita.com/daikiojm/items/89f46bd83c9a2285bbc6

まずプロジェクト作成

ionic start

その後、作成したフォルダに移動

ionic cordova build browser --prod --release

初期化

firebase init

hostingを選んで、プロジェクト選んで、SPAとして登録

プロジェクトのルートに設定ファイルがあるので編集

vi firebase.json
{
  "hosting": {
    "public": "public",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  }
}

というのを下記のように変更する

{
  "hosting": {
    "public": "www",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  }
}

firebase deploy

でできました。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?