LoginSignup
1
1

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の場合

まずプロジェクト作成

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