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

177
Visualizações
Module not found: Can't resolve 'firebase' in react js

In my reactjs project I have installed firebase using 'npm i firebase'. And inside of src folder I have created firebase.js file for firebase config.

import firebase from 'firebase'

const firebaseConfig = {
  apiKey: "******",
  authDomain: "****",
  projectId: "***",
  storageBucket: "*****",
  messagingSenderId: "****",
  appId: "****"
};

firebase.initializeApp(config);

export default firebase

Even after installing firebase in my project. It gives error:

./src/firebase.js
Module not found: Can't resolve 'firebase' in '/home/rupak/Projects/web/firebasereact/src'

Can anyone find the problem?

about 4 years ago · Juan Pablo Isaza
3 Respostas
Responde à pergunta

0

You are not using the new Modular syntax. You can keep using existing code by changing the imports to compat version:

import firebase from 'firebase/compat/app'
import 'firebase/firestore'
// import 'firebase/[SERVICE_NAME]'

However, I'd recommend upgrading to the new Modular SDK, which offers some benefits with tree-shaking. Checkout this Firecast for detailed information:

Getting started with Firebase for Web

about 4 years ago · Juan Pablo Isaza Relatório

0

Refer Firebase docs if you are using newer version initializeApp is moved to firebase/app package

about 4 years ago · Juan Pablo Isaza Relatório

0

Hey I had the same situation stated above... But by applying this:

import firebase from 'firebase/compat/app'
import 'firebase/firestore'
// import 'firebase/[SERVICE_NAME]'
//export
export const auth = firebase.auth();
export const googleAuthProvider = new firebase.auth.GoogleAuthProvider();

I only removed the (/app), and it worked... THANK YOU

about 4 years ago · Juan Pablo Isaza Relatório
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