Lazy-load the Firestore with standalone components
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 30/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- angular, firebase, typescript
Direzione di ricerca
Inizia leggendo il componente autonomo get-firestore.ts e gli entry point provideFirestore/getFirestore mostrati nel report. Riproduci l’errore a runtime con le versioni indicate di Angular, Firebase e AngularFire, quindi documenta o implementa il percorso di lazy loading supportato e verifica che Firestore non venga inizializzato nella configurazione dell’app.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- TypeScript
- Stelle
- 7.8k
- Fork
- 2.2k
- Merge medio
- 3g 6h
- PR unite (30g)
- 5
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di angular/angularfire
-
comp: build/pipeline type: bug version: current (v17+)
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
angular/angularfire#3766 ·
-
comp: schematics type: bug version: current (v17+)
Difficoltà 3/5 1-2 giorni Idoneità per principianti 76/100
angular/angularfire#3768 ·
-
comp: docs type: chore version: current (v17+)
Difficoltà 4/5 3-5 giorni Idoneità per principianti 58/100
angular/angularfire#3764 ·
-
comp: firestore comp: ssr priority: P0 (critical) type: feature version: current (v17+)
angular/angularfire#3757 · 1 assegnatario ·
-
Six `firebase` entry points have no `@angular/fire` equivalent, so their exports are unreachable Apertacomp: core type: feature
angular/angularfire#3755 · 1 assegnatario ·
Tutte le issue di angular/angularfire
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
bug v2
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
modelcontextprotocol/inspector#2458 · 1 commento ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
railmapgen/rmp-gallery#4068 ·
-
Mend: dependency security vulnerability status: needs triage 🕵️♀️
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
carbon-design-system/ibm-products#9907 ·