skip to Main Content

i am facing a problem since past days, and not able to solve it
can anyone help me slight to make it work efficiently

Moreover also have degraded firebase to 9.6.11 as per other solutions on similar site.


import firebase from "firebase/compat/app";
import "firebase/compat/auth";
import "firebase/compat/firestore";

// Your web app's Firebase configuration
const firebaseConfig = {
  apiKey: ".......................",
  authDomain: ".......................",
  projectId: ".......................",
  storageBucket: ".......................",
  messagingSenderId: ".......................",
  appId: "......................."
};

// Initialize Firebase
let app;
if (firebase.apps.length === 0) {
  app = firebase.initializeApp(firebaseConfig);
} else {
  app = firebase.app()
}

const auth = firebase.auth()

export { auth };````

3

Answers


  1. Chosen as BEST ANSWER

    the issue is solved thanks. Create a new file metro.config.js in the root folder of your project and add the code snippet in it.

    const { getDefaultConfig } = require("@expo/metro-config");
    
    const defaultConfig = getDefaultConfig(__dirname);
    
    defaultConfig.resolver.assetExts.push("cjs");
    
    module.exports = defaultConfig;
    
    

  2. there’s an issue open on the metro repo facebook/metro#535

    builds work fine again for me after adding this to my metro config:

    resolver: {
        sourceExts: ['js', 'json', 'ts', 'tsx', 'cjs'],
      },
    
    Login or Signup to reply.
  3. Though the most upper one resolve the issue. If you want to know more, follow this official link – https://docs.expo.dev/guides/using-firebase/#step-3-configure-metro

    Or just paste the code in a new file metro.config.js on your root project folder –

    const { getDefaultConfig } = require('@expo/metro-config');
    const defaultConfig = getDefaultConfig(__dirname);
    defaultConfig.resolver.assetExts.push('cjs');
    module.exports = defaultConfig;
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search