Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Expo Firebase Authentication "While trying to resolve module `idb` from file"

This is my first app. I'm trying to use Firebase for Email/Password authentication. I followed the basic tutorial https://firebase.google.com/docs/auth/web/password-auth#web-version-9, and I keep getting this error:

While trying to resolve module `idb` from file '.../node_modules/@firebase/app/dist/esm/index.esm2017.js', the package `/Users/##/##/##/node_modules/idb/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`/Users/##/##/##/node_modules/idb/build/index.cjs`. 

I've added this to metro.config.js:

  resolver: {
    sourceExts: ['jsx', 'js', 'ts', 'tsx', 'cjs'],
  },

and the issue is still there.

like image 392
KrishP Avatar asked Jan 21 '26 20:01

KrishP


1 Answers

To resolve this issue, create a metro.config.js file in the project root. In the file add the file extension cjs. details

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

const defaultConfig = getDefaultConfig(__dirname);

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

module.exports = defaultConfig;

ScreenShot

like image 154
Sohel Islam Imran Avatar answered Jan 27 '26 02:01

Sohel Islam Imran