英文:
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!
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论