0

Here is the code I currently have. I get this error in the console when the page opens:

Uncaught TypeError: The specifier “firebase/app” was a bare specifier, but was not remapped to anything. Relative module specifiers must start with “./”, “../” or “/”.

I'm not sure why this is happening as I already installed firebase in the project with npm. Any help with configuring Firebase/Firestore for my npm project? If it helps, I am using Vercel to host the site. Thanks in advance!

// -------------------- Firebase --------------------

// Import
import { initializeApp } from "firebase/app";
import {
    getFirestore,
    collection,
    addDoc,
    query,
    orderBy,
    getDocs
} from "firebase/firestore";

// Config
const firebaseConfig = {
  apiKey: "AIzaSyC5Z4qgNukP7bE4WcwDKZy4I2rfUu7JlyE",
  authDomain: "my-website-f9ff7.firebaseapp.com",
  projectId: "my-website-f9ff7",
  storageBucket: "my-website-f9ff7.appspot.com",
  messagingSenderId: "1048930604953",
  appId: "1:1048930604953:web:4c0dc70917d6ce70f0e508"
};

// Initialize
const app = initializeApp(firebaseConfig);
const commentsDb = getFirestore();
2
  • 2
    Your code seems fine but depends how you run and publish your project, what your bundler is doing etc. We need more information. Commented 2 days ago
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. Commented 2 days ago

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.