Home > front end >  Unable to resolve "idb" from "node_modules\@firebase\app\dist\esm\index.esm2017.
Unable to resolve "idb" from "node_modules\@firebase\app\dist\esm\index.esm2017.

Time:08-25

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 };````

CodePudding user response:

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'],
  },

CodePudding user response:

the issue is solved thanks

By adding

const { getDefaultConfig } = require("@expo/metro-config");

const defaultConfig = getDefaultConfig(__dirname);

defaultConfig.resolver.assetExts.push("cjs");

module.exports = defaultConfig;

  • Related