简体   繁体   English

"<i>Vue 2;<\/i> Vue 2;<\/b> <i>export &#39;default&#39; (imported as &#39;firebase&#39;) was not found in &#39;firebase\/app&#39;<\/i>在“firebase\/app”中找不到导出“默认”(导入为“firebase”)<\/b>"

[英]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.

相关问题 firebase 存储:在“firebase/app”中找不到导出“存储”(导入为“firebase”)继续 - firebase storage: export 'storage' (imported as 'firebase') was not found in 'firebase/app' Continuation Vue 2 和 Firebase 9 - “在‘firebase/firestore’中找不到导出‘getFirestore’ - Vue 2 and Firebase 9 - "export 'getFirestore' was not found in 'firebase/firestore' 尝试导入错误:“firebase/app”不包含默认导出(导入为“firebase”) - Attempted import error: 'firebase/app' does not contain a default export (imported as 'firebase') 在 Vue 3 和 Laravel 的“vue”中找不到导出“默认”(导入为“Vue”) - export 'default' (imported as 'Vue') was not found in 'vue' in Vue 3 and Laravel 在“firebase/app-check”中找不到导出“getToken”(导入为“getToken$1”)(模块没有导出) - export 'getToken' (imported as 'getToken$1') was not found in 'firebase/app-check' (module has no exports) “在&#39;!! babel-loader中找不到导出&#39;默认&#39;(导入为&#39;__vue_script__&#39;) - "export 'default' (imported as '__vue_script__') was not found in '!!babel-loader VueJS Firebase app导出默认错误的问题 - VueJS Firebase app problem of export default error 在“./app/store”中找不到导出“store”(导入为“store”)(可能的导出:默认) - export 'store' (imported as 'store') was not found in './app/store' (possible exports: default) 类型错误:firebase_app__WEBPACK_IMPORTED_MODULE_0___default.a.analytics 不是 function - TypeError: firebase_app__WEBPACK_IMPORTED_MODULE_0___default.a.analytics is not a function 获取类型错误:firebase_app__WEBPACK_IMPORTED_MODULE_0__.initializeApp 不是使用 Vue3 的 function,Firebase 8.5 - Getting TypeError: firebase_app__WEBPACK_IMPORTED_MODULE_0__.initializeApp is not a function using Vue3, Firebase 8.5
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM