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

136
Visualizações
Firebase 9.6.6 JS from CDN errors out

I am trying to hook CDN based firebase libs for one of my project and as per the doc its doable https://firebase.google.com/docs/web/alt-setup

But when i put below html/js code

<html>
<body>
  <script type="module">
    import { initializeApp } from 'https://www.gstatic.com/firebasejs/9.6.6/firebase-app.js'
    // Add Firebase products that you want to use
    import { auth } from 'https://www.gstatic.com/firebasejs/9.6.6/firebase-auth.js'
    const firebaseConfig = {
        apiKey: "<>",
        authDomain: "<>.firebaseapp.com",
        projectId: "<>",
        storageBucket: "<>.appspot.com",
        messagingSenderId: "<>",
        appId: "<>",
        measurementId: "<>"
   };
    // Initialize Firebase
    const app = initializeApp(firebaseConfig);
  </script>
</body>
</html>

Its error out with below log (seen on console)

Uncaught SyntaxError: import not found: auth

I do not want to fallback to older version of firebase, so is there any solution someone can suggest?

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

0

You're importing the modular SDK, which does not export an auth symbol. To get access to the auth service, import the getAuth function:

import { getAuth } from 'https://www.gstatic.com/firebasejs/9.6.6/firebase-auth.js'

And then call it as:

const auth = getAuth();

// And then for example: createUserWithEmailAndPassword(auth, email, password)

I recommend keeping the Firebase documentation on getting started with authentication on the web handy while getting started, as it has handy copy/pasteable code snippets for common operations like this.

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