[英]Vue 2; export 'default' (imported as 'firebase') was not found in 'firebase/app'
I'm trying to import firebase in a Vue 2 app, but I'm running into this annoying issue.我正在尝试在 Vue 2 应用程序中导入 firebase,但我遇到了这个烦人的问题。
My imports look like:我的进口看起来像:
import firebase from 'firebase/app'
import 'firebase/auth'
import 'firebase/firestore'
Due to Doug Stevenson's suggestion to check my firebase version, I ended up checking firebase's upgrade docs and found this https://firebase.google.com/docs/web/modular-upgrade由于 Doug Stevenson 建议检查我的 firebase 版本,我最终检查了 firebase 的升级文档并找到了这个https://firebase.google.com/docs/web/modular-upgrade
Following the instructions there (changing the paths from firebase/x to firebase/compat/x) fixed my issue perfectly.按照那里的说明(将路径从 firebase/x 更改为 firebase/compat/x)完美地解决了我的问题。 Thank you all, and I hope any other clueless folk like myself confused by the new format can be helped by this post.
谢谢大家,我希望像我这样对新格式感到困惑的其他无知的人可以通过这篇文章得到帮助。
Due to release of Firebase SDK Version 9 on 25th August 2021, many users using Firebase Web SDK version 8 are struggling with the same issue.由于 Firebase SDK 版本 9 于 2021 年 8 月 25 日发布,许多使用 Firebase Web SDK 版本 8 的用户都在为同样的问题苦苦挣扎。
According to the documentation, Apps currently using Firebase Web SDK version 8 or earlier should consider migrating to version 9 as follows:根据文档,当前使用 Firebase Web SDK 版本 8 或更早版本的应用应考虑迁移到版本 9,如下所示:
Before: version 8 (Old)之前:版本 8(旧)
import firebase from 'firebase/app';
import 'firebase/auth';
import 'firebase/firestore';
After: version 9 compat (New)之后:版本 9 兼容(新)
// v9 compat packages are API compatible with v8 code
import firebase from 'firebase/compat/app';
import 'firebase/compat/auth';
import 'firebase/compat/firestore';
在我的反应项目中为这三行添加\/compat<\/strong>
import firebase from 'firebase\/compat\/app'; import 'firebase\/compat\/auth'; import 'firebase\/compat\/firestore';<\/code>
"
Thanks brody you save my ass!谢谢布罗迪你救了我的屁股! :D Gracias!
:D 谢谢!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.