Deploy  Nextjs web app to Firebase Hosting

Deploy Nextjs web app to Firebase Hosting

Firebase recently introduced a new and faster way of deploying your nextjs application to firebase, but it is still in beta.

Install the latest version of firebase cli

Please install the latest version of the cli if your firebase CLI is not version 11.14.2 or later

npm install -g firebase-tools

Enable the experiment which detects the framework

When you enable the webframeworks experiment, firebase will be able to know which framework you are using, which is nextjs in our case, firebase will then set up all the configuration needed.

firebase experiments:enable webframeworks

Initialize hosting

firebase init hosting

Deploy your app

firebase deploy

NB// You will need to enable billing in your firebase project if any of your nextjs pages is server side rendered, because it will have to use firebase cloud functions

Congratulations🥳, your nextjs web app should be deployed successfully