Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

306
Visualizações
config.js:17 Uncaught ReferenceError: firebase is not defined in React propject compiled by webpack

I am doing a React project, I want to use several firebase/firestre module, however it show me this error message I checked my webpack package.json, there is "firebase": "^9.6.11", under "dependencies",

and i also init the firebase with Firestore and configure hosting. Here is my chatbox.js file, maybe it can perform more detail.

import React from "react";
import {getAuth, createUserWithEmailAndPassword, signInWithEmailAndPassword} from "firebase/auth";
import {collection, getDoc, getDocs, addDoc, updateDoc, setDoc, Timestamp, doc} from "firebase/firestore";
import {db} from "../config";

function write_message(chatroomID, message) {
    console.log(getAuth().currentUser.uid + ' is sending message \"' + message + '\" to ' + chatroomID)
    var chatroom_docref = doc(db, collection(db ,'chatroom'), chatroomID);
    updateDoc(chatroom_docref, {
        last_time: Timestamp.fromDate(new Date()),
        last_text: message,
        msg_count: chatroom_docref.msg_count + 1
    });
    var messages_colref = collection(db, chatroom_docref + '\\messages')
    setDoc(doc(db, collection(db, messages_colref, chatroomID + chatroom_docref.msg_count)), {
        people: getAuth().currentUser.uid,
        time: Timestamp.fromDate(new Date()),
        text: message,
        msg_ID: chatroomID + chatroom_docref.msg_count
    })
}

My project is due within 10 hours, pls someone help...... Moreover, there is several warning message more below the Uncaught Reference Error

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda