How to deploy next.js app on Firebase Hosting?

后端 未结 2 1617
不知归路
不知归路 2021-02-18 14:31

I am trying to deploy next.js app on Firebase hosting. But I don\'t understand which files to push to the server. When I run npm run build and pushed the build fold

2条回答
  •  野的像风
    2021-02-18 14:38

    Check this out first. This is the official example provided by the next.js in their github repo.

    The idea behind the example

    The goal is to host the Next.js app on Firebase Cloud Functions with Firebase Hosting rewrite rules so our app is served from our Firebase Hosting URL. Each individual page bundle is served in a new call to the Cloud Function which performs the initial server render.

    This is based off of the work at https://github.com/geovanisouza92/serverless-firebase & https://github.com/jthegedus/firebase-functions-next-example as described here.

    PS : I know posting links as answers is not the best way, but my rep power is not enough to put this as a comment.


    Update

    I recently found out that firebase git repo has a nextjs example, be sure to check this out too. Path in the repo => firebase/functions-samples/nextjs-with-firebase-hosting

提交回复
热议问题