Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Import only auth and firestore from firebase

Tags:

I am attempting to reduce the firebase library size in my vuejs app. I currently import firebase as

import * as firebase from 'firebase';
require("firebase/firestore");

Inside my vendor file I have the database and messaging services but I have no use for them. enter image description here

How do I go about only importing auth and firestore into firebase object?

like image 744
Iglo Avatar asked Feb 10 '18 07:02

Iglo


People also ask

How do I import Auth from Firebase app?

Import firebase and firebase/authimport firebase from "firebase/app"; import "firebase/auth"; Place a FirebaseAuthProvider component at the top level of your app. ( anywhere as long as it's above the other Auth components ). Then use any of the other components anywhere in your component tree.

Can I use Firebase for authentication only?

You can use Firebase Authentication to allow users to sign in to your app using one or more sign-in methods, including email address and password sign-in, and federated identity providers such as Google Sign-in and Facebook Login.


1 Answers

First you need to import the core

import * as firebase from 'firebase/app';

then import required modules

import 'firebase/auth';
import 'firebase/firestore';

or

var firebase = require("firebase/app");
require("firebase/auth");
require("firebase/database");
like image 183
Alex Mounir Avatar answered Sep 22 '22 15:09

Alex Mounir