我正在按照官方 Google 教程示例通过 CDN 而不是 SDK 包含 Firebase:
https://firebase.google.com/docs/web/alt-setup#from-the-cdn
逐字复制示例后:
<body>
<!-- Insert this script at the bottom of the HTML, but before you use any Firebase services -->
<script type="module">
import { initializeApp } from 'https://www.gstatic.com/firebasejs/9.4.1/firebase-app.js'
// If you enabled Analytics in your project, add the Firebase SDK for Google Analytics
import { analytics } from 'https://www.gstatic.com/firebasejs/9.4.1/firebase-analytics.js'
// Add Firebase products that you want to use
import { auth } from 'https://www.gstatic.com/firebasejs/9.4.1/firebase-auth.js'
import { firestore } from 'https://www.gstatic.com/firebasejs/9.4.1/firebase-firestore.js'
</script>
</body>
我得到浏览器错误:
未捕获的语法错误:请求的模块“https://www.gstatic.com/firebasejs/9.4.1/firebase-auth.js”未提供名为“auth”的导出
将 auth import 行注释掉,你会得到与 firestore 导入行完全相同的错误。
这是文件/教程的问题还是我的问题?
似乎教程指的是错误的文件?