Lazy-load the Firestore with standalone components
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 30/100
- Issue-Typ
- Feature
- Klarheit
- Muss geklärt werden
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- angular, firebase, typescript
Rechercherichtung
Beginne damit, die eigenständige Komponente get-firestore.ts sowie die im Bericht gezeigten Einstiegspunkte provideFirestore/getFirestore zu lesen. Reproduziere den Laufzeitfehler mit den aufgeführten Versionen von Angular, Firebase und AngularFire. Dokumentiere anschließend den unterstützten Pfad für Lazy Loading oder implementiere ihn und überprüfe, dass Firestore in der App-Konfiguration nicht initialisiert wird.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Hi, is there a way to lazy-load the Firestore?
I'm using it only in a lazy-loaded component, so I would like to avoid providing it in the app config with
provideFirestore(() => getFirestore())
I followed this example: https://github.com/angular/angularfire/blob/main/samples/advanced/src/app/firestore/firestore.component.ts
I have a get-firestore.ts with this content:
import { getFirestore } from '@angular/fire/firestore';
export const firestore = getFirestore();
and I try to lazy-load it like this:
constructor() {
this.initFirestore();
}
private async initFirestore() {
const { firestore } = await import('./get-firestore');
this.firestore = firestore;
}
But I get this error at run-time:
Error: Either AngularFireModule has not been provided in your AppModule (this can be done manually or implictly using
provideFirebaseApp) or you're calling an AngularFire method outside of an NgModule (which is not supported).
Even if I add the AngularFireModule to the component's imports, it doesn't change.
So, what's the right way to lazy-load the FIrestore, with standalone components?
Version info
Angular: 19.0.0
Firebase: 10.12.0
AngularFire: 18.0.1
- Vorherrschende Sprache
- TypeScript
- Sterne
- 7.8k
- Forks
- 2.2k
- Ø Merge
- 3 T. 6 Std.
- Gemergte PRs (30 T.)
- 5
Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus angular/angularfire
-
comp: build/pipeline type: bug version: current (v17+)
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
angular/angularfire#3766 ·
-
comp: schematics type: bug version: current (v17+)
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 76/100
angular/angularfire#3768 ·
-
comp: docs type: chore version: current (v17+)
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 58/100
angular/angularfire#3764 ·
-
comp: firestore comp: ssr priority: P0 (critical) type: feature version: current (v17+)
angular/angularfire#3757 · 1 zugewiesene Person ·
-
Six `firebase` entry points have no `@angular/fire` equivalent, so their exports are unreachable Offencomp: core type: feature
angular/angularfire#3755 · 1 zugewiesene Person ·
Alle Issues in angular/angularfire
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
-
bug v2
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
modelcontextprotocol/inspector#2458 · 1 Kommentar ·
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 75/100
railmapgen/rmp-gallery#4068 ·
-
Mend: dependency security vulnerability status: needs triage 🕵️♀️
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
carbon-design-system/ibm-products#9907 ·