close

[Solved] Module ‘”@angular/fire/database”‘ has no exported member ‘AngularFireDatabaseModule’

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error Module ‘”@angular/fire/database”‘ has no exported member ‘AngularFireDatabaseModule’ in angular. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How To Solve Module ‘”@angular/fire/database”‘ has no exported member ‘AngularFireDatabaseModule’ Error ?

  1. How To Solve Module '”@angular/fire/database”' has no exported member 'AngularFireDatabaseModule' Error ?

    To Solve Module '”@angular/fire/database”' has no exported member 'AngularFireDatabaseModule' Error AngularFire 7.0.0 was launched yesterday with a new API that has a lot of bundle size reduction benefits. Instead of top level classes like AngularFireDatabase, you can now import smaller independent functions. The initialization process is a bit different too as it has a more flexible API for specifying configurations.

  2. Module '”@angular/fire/database”' has no exported member 'AngularFireDatabaseModule'

    To Solve Module '”@angular/fire/database”' has no exported member 'AngularFireDatabaseModule' Error AngularFire 7.0.0 was launched yesterday with a new API that has a lot of bundle size reduction benefits. Instead of top level classes like AngularFireDatabase, you can now import smaller independent functions. The initialization process is a bit different too as it has a more flexible API for specifying configurations.

Solution 1

AngularFire 7.0.0 was launched yesterday with a new API that has a lot of bundle size reduction benefits.

Instead of top level classes like AngularFireDatabase, you can now import smaller independent functions.

import { list } from '@angular/fire/database';

The initialization process is a bit different too as it has a more flexible API for specifying configurations.

@NgModule({
    imports: [
        provideFirebaseApp(() => initializeApp(config)),
        provideFirestore(() => {
            const firestore = getFirestore();
            connectEmulator(firestore, 'localhost', 8080);
            enableIndexedDbPersistence(firestore);
            return firestore;
        }),
        provideStorage(() => getStorage()),
    ],
})

If you want to proceed with the older API there’s a compatibility layer.

import { AngularFireModule} from '@angular/fire/compat'
import { AngularFireDatabaseModule } from '@angular/fire/compat/database';

Solution 2

Here my code, working as of 1 Sep 2021

import { AngularFireAuthModule } from "@angular/fire/compat/auth";
import { AngularFireModule } from '@angular/fire/compat';

const firebaseConfig = [
  AngularFireAuthModule,
  AngularFireModule.initializeApp(environment.firebase) // Your config
];

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read

Leave a Comment