Get Rid of Firebase Development Mode Warning in Vue.js

Last modified on September 19th, 2022
Raja Tamil
Firebase Vue.js

When you’re using Firebase version 8 in the Vue JS app, you’ll probably get a warning similar to the screenshot below.

It looks like you're using the development build of the Firebase JS SDK.
When deploying Firebase apps to production, it is advisable to only import
the individual SDK components you intend to use.

For the module builds, these are available in the following manner
(replace <PACKAGE> with the name of a component - i.e. auth, database, etc):

CommonJS Modules:
const firebase = require('firebase/app');

ES Modules:
import firebase from 'firebase/app';
import 'firebase/<PACKAGE>';

import * as firebase from 'firebase/app';
import 'firebase/<PACKAGE>';

This will happen when you import Firebase anywhere in the project using the following code :

import firebase from "firebase";

When you use the above code, it actually imports all of the firebase products such as Authentication, Storage, etc, available to use right off the bat, even the ones that you do not intend to use.

This can be inefficient as it will add extra Javascript code to the project that is not needed.

Let see how to get rid of this warning.

Instead, you can import only the Firebase service that you intend to use as you need them.

So, in your main.js file replace the following code:


import firebase from "firebase";


import firebase from "firebase/app";

Then, you can add the two lines mentioned in the warning message to your Vue component.

Lets say you’ve a component name Signup.vue and intend to use Firebase Authentication in it.

Your import statement should look like this:

import firebase from "firebase/app";
import "firebase/auth";

This will get rid of the warning.

Vue JS & Google Maps API