我正在为我的应用程序的后端部分使用 firebase。我的代码是这样的:
<script type="module">
// Import the functions you need from the SDKs you need
import { initializeApp } from "https://www.gstatic.com/firebasejs/9.6.1/firebase-app.js";
// TODO: Add SDKs for Firebase products that you want to use
// https://firebase.google.com/docs/web/setup#available-libraries
import {getFirestore,collection,getDocs} from 'firebase/firestore/lite'
// Your web app's Firebase configuration
const firebaseConfig = {
//My app's Config object...
};
// Initialize Firebase
const app = initializeApp(firebaseConfig);
</script>
<script src="https://www.gstatic.com/firebasejs/9.6.1/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/9.6.1/firebase-auth.js"></script>
<script src="https://www.gstatic.com/firebasejs/9.6.1/firebase-firestore.js"></script>
授权脚本:
const auth=firebase.auth();
const db=firebase.firestore();
我在浏览器控制台中收到这些错误:
Uncaught SyntaxError: Unexpected token 'export'
Uncaught SyntaxError: Cannot use import statement outside a module
Uncaught SyntaxError: Cannot use import statement outside a module
Uncaught ReferenceError: firebase is not defined at auth.js:1
有人可以帮帮我吗!