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

549
Visualizações
Warning: It looks like you're using the development build of the Firebase JS SDK

I've integrated Firebase into my React.js app as such: https://firebase.google.com/docs/database/web/start

fire.js:
import firebase from 'firebase'

var config = {
  apiKey: "####",
  authDomain: "#",
  databaseURL: "#",
  projectId: "#",
  storageBucket: "#",
  messagingSenderId: "#"
};
var fire = firebase.initializeApp(config);
export default fire;
App.js:
import fire from './fire';

class App extends Component {
    componentWillMount(){
        let messagesRef = fire.database().ref('messages').orderByKey().limitToLast(100);
    }
}

But now I'm getting this warning in the console:

It looks like you're using the development build of the Firebase JS SDK. When deploying Firebase apps to production, it is advisable to only import the individual SDK components you intend to use.

For the module builds, these are available in the following manner (replace with the name of a component - i.e. auth, database, etc):

CommonJS Modules: const firebase = require('firebase/app'); require('firebase/');

ES Modules: import firebase from 'firebase/app'; import 'firebase/';

How do I fix this warning?

I have tried (in fire.js) changing this:

import firebase from 'firebase'

To this:

import firebase from 'firebase/app'

That results in this error: enter image description here

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

The proper way to import firebase is as such:

import firebase from 'firebase/app';
import 'firebase/database'; // If using Firebase database
import 'firebase/storage';  // If using Firebase storage
over 4 years ago · Santiago Trujillo Relatório

0

The proper way to import firebase and getting rid of the warnings is:

Always import this way

import firebase from 'firebase/app';

Then import each sub-modules (each firebase service) as needed

import 'firebase/auth';        // for authentication
import 'firebase/storage';     // for storage
import 'firebase/database';    // for realtime database
import 'firebase/firestore';   // for cloud firestore
import 'firebase/messaging';   // for cloud messaging
import 'firebase/functions';   // for cloud functions
over 4 years ago · Santiago Trujillo Relatório

0

The warning is rather informative and lays out exactly what you need to do. In your case, this is the line thats telling you to switch up the way you are importing your files:

ES Modules: import firebase from 'firebase/app'; import 'firebase/';

In your fire.js file try changing this:

import firebase from 'firebase'

To this:

import firebase from 'firebase/app'

That should clear it up!

Side note:

In my case I was using firestore so I had an additional import that I also changed from:

import firestore from 'firebase/firestore'

To:

import 'firebase/firestore'
over 4 years ago · Santiago Trujillo 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