Hosting Next.js Applications on Firebase

Install Firebase CLI Tools:

Open your terminal and install the Firebase CLI tools globally using the command.

npm install -g firebase-tools

Login to Your Account:

Log in to your Firebase account from the terminal:

firebase login

Config Next.config.js file

Add export command:

/** @type {import('next').NextConfig} */
const nextConfig = { output: 'export' } //Add this Line
module.exports = nextConfig

Run Build:

Execute the build script using:

npm run build

Deploy to Firebase Hosting:

Finally, deploy your Next.js application to Firebase Hosting:

firebase deploy --only hosting

Leave a comment

Your email address will not be published. Required fields are marked *