project was working fine, but for no reason i start getting this error Uncaught SyntaxError: ambiguous indirect export: getFirestore

huangapple go评论62阅读模式
英文:

project was working fine, but for no reason i start getting this error Uncaught SyntaxError: ambiguous indirect export: getFirestore

问题

我的项目使用Firebase作为后端,这是配置文件:

import { initializeApp } from "firebase/app";
import { getAuth } from "firebase/auth";
import { getFirestore } from "firebase/firestore";
import { getStorage } from "firebase/storage";

const firebaseConfig = {
  // 配置信息...
};

const app = initializeApp(firebaseConfig);

export const auth = getAuth(app);
export const db = getFirestore(app);
export const storage = getStorage(app);

尝试使用as来重命名函数:

import { getFirestore as getFirestoreFunction } from "firebase/firestore";

对于getFirestore工作正常。

未捕获的语法错误:模糊的间接导出:initializeApp

尝试对initializeApp做同样的操作:

import { initializeApp as initFirebaseApp } from "firebase/app";

未捕获的语法错误:模糊的间接导出:initializeApp

这里使用的Firebase版本是 "firebase": "^8.6.8"。

英文:

my project uses firebase for backend this is this config file

import { initializeApp } from "firebase/app";
import { getAuth } from "firebase/auth";

import { getFirestore } from "firebase/firestore";

import { getStorage } from "firebase/storage";

const firebaseConfig = {
  stuff ...
};

const app = initializeApp(firebaseConfig);

export const auth = getAuth(app);

export const db = getFirestore(app);

export const storage = getStorage(app);

tried to use as to rename the function

import { getFirestore as getFirestoreFunction } from "firebase/firestore";

> worked for getFirestore

> Uncaught SyntaxError: ambiguous indirect export: initializeApp

> tried to do the same for initializeApp

import { initializeApp as initFirebaseApp } from "firebase/app";

> Uncaught SyntaxError: ambiguous indirect export: initializeApp

here is the version "firebase": "^8.6.8"

答案1

得分: 0

似乎您正在运行一个过时的 Firebase 版本。安装最新版本理论上应该解决您遇到的问题。您可以参考此链接上的评论:https://stackoverflow.com/a/70164464/19119712

如果在更改后问题解决了,请告诉我。祝好运!

英文:

Seems like you are running an outdated version of firebase. Installing the latest version should ideally solve the problem you're facing. You can follow the comments on this: https://stackoverflow.com/a/70164464/19119712

Let me know if it worked if/when you make the change. Good luck!

huangapple
  • 本文由 发表于 2023年7月13日 23:28:01
  • 转载请务必保留本文链接:https://go.coder-hub.com/76681073.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定