Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

import * as firebase from 'firebase' no longer working as of Angular 6 update

I recently updated my Angular 5 project to Angular 6 and I've been trying to build and deploy all day. My latest problem is one with importing - it was working fine before.

The error now says cannot find module 'firebase' in my import.

cannot find module 'firebase'

like image 707
FiringBlanks Avatar asked Jul 22 '18 23:07

FiringBlanks


People also ask

Does firebase work with Angular?

We'll be able to create, delete tasks, and transfer them from one category to another using drag and drop. We'll develop the user interface using Angular and use Firestore as our persistent store. At the end of the codelab we'll deploy the app to Firebase Hosting using the Angular CLI.

How to integrate firebase with angular 8?

Before start Firebase integration in Angular 8. We need a Angular 8 Project. If you don’t know how to create a new angular 8 project. Follow this tutorial. To make any type of interaction with the Firebase server you need firebase module. To install it type the below command and hit enter, will install the firebase module

How to use firebase with FireStore/functions?

Sign in to your account Firebase SDK version: 6.28.1 Firebase Component: Whole Firebase framework (Auth, Core, Database, Firestore, Messaging, Storage, etc) Component version: 6.28.1 Just install firebase with some components like functions and firestore, then try to use firestore/functions with imported Firesbase.

How to get app settings for your Firebase project?

These are unique to each Firebase Project and I am going to show you how to get them for your Firebase project, by following the steps below: The first step is to go to the settings of your project. At the bottom of the Projects’ Setting Web Page, you will see a list of “Your Apps” section.

Can I use Firebase 8 code in Firebase 9?

Using the compat libraries during upgrade allows you to continue using version 8 code alongside code refactored for version 9. This means you can keep existing version 8 code for Cloud Firestore while you refactor Authentication or other Firebase SDK code to the version 9 style, and still successfully compile your app with both code styles.


1 Answers

For Angular 6+ import firebase core and services as follows:

/*
* reduce the amount of code that your app uses by 
* only including the features that you need.
*/

// import core firebase client (required)
import firebase from '@firebase/app';

// import Firebase Authentication (optional)
import '@firebase/auth';

// import Firebase Realtime Database (optional)
import '@firebase/database';

// import Cloud Firestore (optional)
import '@firebase/firestore';

Se official docs for more information.

like image 157
guillefd Avatar answered Oct 13 '22 10:10

guillefd