Deploying a Vue.js app to Firebase Hosting is fast and easy. Firebase offers speed, SSL security, and easy updates. This guide walks you through setup, build, and deployment steps.
Prerequisites for Deploying Vue.js app
- Node.js and npm installed
- A Vue.js project (create with
vue create
ornpm create vue@latest
)

- A Firebase account (free tier works)
Step-by-Step Firebase Hosting Setup for Vue.js
Step 1: Install Firebase CLI and log in.
- Install Firebase CLI.
Firebase CLI can be installed globally or project level.
To install globally,
npm install -g firebase-tools
To install project level,
npm install firebase-tools --save-dev
- Log in to Firebase.
firebase login
//If firebase CLI is installed project level
npx firebase login
Step 2: Initialize Firebase in Your Vue.js project
- Navigate to the project folder.
- Run:
firebase init
//If firebase CLI is installed project level
npx firebase init
- It will ask series of questions.
- Select Hosting using the spacebar and press Enter.

- Choose Create a new Firebase project or link an existing one.

- Set your public directory as dist (the folder created by npm run build)

- Configure as a single-page app (type y if using Vue Router with history mode and N for hash mode).

- Decline overwriting existing files (type n unless you need to reset configurations).
This creates firebase.json with hosting rules. Your configuration file will look like this.
{
"hosting": {
"public": "dist",
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
Step 3: Build Your Vue.js App for Production
- Run:
npm run build
This generates a dist folder with optimized HTML, CSS, and JS.

Step 4: Deploy to Firebase Hosting
- Run:
firebase deploy
- Wait for the “Deploy complete” message.
- Your app’s live URL will appear (e.g., your-project.web.app).
You are done with deploying Vue.js app and visit the URL to test your deployed app.
Related Articles :
I like the efforts you have put in this, regards for all the great content.