LoginSignup
4
2

More than 3 years have passed since last update.

【React】Next.jsをfirebaseにデプロイする方法

Posted at

package.jsonを修正

"start"に「-p $PORT"」を追記かつ、"export"を追加

  "scripts": {
    "dev": "next",
    "build": "next build",
    "start": "next start -p $PORT",
    "export": "next export"
  },

build & export

以下コマンドを叩いて、ビルドする

npm run build

そのあと、エクスポートする

npm run export

build&exportに成功するとoutフォルダに、静的ファイルが吐き出される

firebaseのデプロイ準備

まずは、以下コマンドを叩く

firebase init

各質問に答えていき、以下の質問の際に「out」を入力する

? What do you want to use as your public directory? out

firebase.jsonに正しい内容が記載されていることを確認して、デプロイ実行

firebase deploy

以上!

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