项目一直运行良好,但突然出现了这个错误Uncaught SyntaxError: ambiguous indirect export: getFirestore,原因不明
P粉790819727
P粉790819727 2023-09-04 22:24:44
[React讨论组]
<p>我的项目使用Firebase作为后端,这是配置文件:</p> <pre class="brush:php;toolbar:false;">import { initializeApp } from &quot;firebase/app&quot;; import { getAuth } from &quot;firebase/auth&quot;; import { getFirestore } from &quot;firebase/firestore&quot;; import { getStorage } from &quot;firebase/storage&quot;; const firebaseConfig = { stuff ... }; const app = initializeApp(firebaseConfig); export const auth = getAuth(app); export const db = getFirestore(app); export const storage = getStorage(app);</pre> <p>尝试使用as重命名函数:</p> <pre class="brush:php;toolbar:false;">import { getFirestore as getFirestoreFunction } from &quot;firebase/firestore&quot;;</pre> <blockquote> <p>对于getFirestore起作用了</p> </blockquote> <blockquote> <p>未捕获的语法错误:不明确的间接导出:initializeApp</p> </blockquote> <blockquote> <p>尝试对initializeApp做同样的操作</p> </blockquote> <pre class="brush:php;toolbar:false;">import { initializeApp as initFirebaseApp } from &quot;firebase/app&quot;;</pre> <blockquote> <p>未捕获的语法错误:不明确的间接导出:initializeApp</p> </blockquote> <p>这里的版本是"firebase": "^8.6.8"</p>
P粉790819727
P粉790819727

全部回复(1)
P粉277824378

看起来你正在运行一个过时的firebase版本。安装最新版本理论上应该解决你面临的问题。你可以参考这个链接上的评论:https://stackoverflow.com/a/70164464/19119712

如果你进行了更改,请告诉我是否有效。祝你好运!

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号