I’ve been trying to set up Firebase and I’ve got it as simple as I can, just connecting the JS and HTML to the Firebase platform. I’ve tried following the docs and a few YouTube videos and I always get one of these errors:
index.js:1 Uncaught SyntaxError: Cannot use import statement outside a module (at index.js:1:1)
Access to script at file:/****/index.js' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, chrome-untrusted, https.
or
Uncaught ReferenceError: Firebase is not defined
This is my code —
js:
import { initializeApp } from 'firebase/app';
import { firebaseConfig } from "./config";
import { getAuth } from 'firebase/auth';
import { getFirestore } from 'firebase/firestore';
const firebaseConfig = {
apiKey: "AIzaSyAF2hE7OOb8VL_13LE2BYNB5FuaVA8nhyM",
authDomain: "tutorbuddy-685a6.firebaseapp.com",
projectId: "tutorbuddy-685a6",
storageBucket: "tutorbuddy-685a6.appspot.com",
messagingSenderId: "346614475073",
appId: "1:346614475073:web:15b31c9f954e0ac7e419c0",
measurementId: "G-S8NRED65K0"
};
const app = initializeApp(firebaseConfig);
const auth = getAuth(app);
const firestore = getFirestore(app);
html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script type="module" src="index.js"></script>
<script src = "index.js" defer></script>
</head>
<body>
</body>
</html>
I’ve got npm and firebase installed as well, I’d be happy to provide more info if needed
The answer is probably ridiculously simple but I’ve been at it for a few hours now haha any help would be really appreciated!!

