ASTRO / Svelte / Rxfire: Named export 'collectionData' not found

Viewed 27

I try to build my astro application. I have one component using svelte and rxFire, but when i try to build id, i receive this error. Try the suggestion bring me to another error like "default member is not exported". It can be a bug from firebase v9 and the compilation from Vite, but how to fix it ?

Package.json

{
  "name": "@example/basics",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "dev": "astro dev",
    "start": "astro dev",
    "build": "astro build",
    "preview": "astro preview",
    "astro": "astro"
  },
  "dependencies": {
    "@astrojs/svelte": "^1.0.0",
    "astro": "^1.2.1",
    "firebase": "^9.9.4",
    "rxfire": "^6.0.3",
    "rxjs": "^7.5.6",
    "svelte": "^3.50.1"
  }
}

Component:

<script>
  import { collection, query } from "firebase/firestore";
  import { firestore } from "../../firebase";
  import { collectionData } from "rxfire/firestore";
  import { startWith, tap } from "rxjs/operators";
  import OpportunityCard from "./OpportunityCard.svelte";

  const opportunitiesQuery = query(collection(firestore, "opportunities"));

  const opportunities = collectionData(opportunitiesQuery, {idField: "id"}).pipe(
    tap(x => console.log(x)),
    startWith([])
  );
</script>

Error during build:

enter image description here

Apply the suggestion:

enter image description here

0 Answers
Related