Tuesday, March 28, 2023
HomeiOS Developmentfirebase - Expo iOS construct failed

firebase – Expo iOS construct failed


Throughout React Native utility iOs construct I am getting an error

❌ Metro encountered an error:
Unable to resolve module ./firebase from /Customers/expo/workingdir/construct/App.js:

None of those recordsdata exist:

  • firebase(.native|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.js|.native.js|.js|>.ios.jsx|.native.jsx|.jsx|.ios.json|.native.json|.json)

  • firebase/index(.native|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.js|.native.js|.js|.ios.jsx|.native.jsx|.jsx|.ios.json|.native.json|.json)

3 | import * as Community from ‘expo-network’

4 | import { assortment, getDocs, question, the place } from ‘firebase/firestore’

5 | import { db, storage } from ‘./firebase’

I attempted to reinstall Firebase, however that does not assist. And I did’t discover any working answer in web

eas-cli/3.7.2 darwin-x64 node-v16.13.0

Bundle.json

{
  "title": "app",
  "model": "1.0.0",
  "predominant": "node_modules/expo/AppEntry.js",
  "scripts": {
    "begin": "expo begin",
    "android": "expo begin --android",
    "ios": "expo begin --ios",
    "net": "expo begin --web",
    "eject": "expo eject"
  },
  "dependencies": {
    "@react-native-async-storage/async-storage": "~1.17.3",
    "@react-navigation/native": "^6.0.10",
    "@react-navigation/native-stack": "^6.6.2",
    "expo": "^47.0.0",
    "expo-file-system": "~15.1.1",
    "expo-linking": "~3.3.1",
    "expo-network": "~5.0.0",
    "expo-splash-screen": "~0.17.5",
    "expo-status-bar": "~1.4.2",
    "expo-updates": "~0.15.6",
    "firebase": "^9.17.1",
    "react": "18.1.0",
    "react-dom": "18.1.0",
    "react-native": "0.70.5",
    "react-native-maps": "1.3.2",
    "react-native-safe-area-context": "4.4.1",
    "react-native-screens": "~3.18.0",
    "react-native-uuid": "^2.0.1",
    "react-native-web": "~0.18.7"
  },
  "devDependencies": {
    "@babel/core": "^7.19.3"
  },
  "non-public": true
}

metro.config.js

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

const defaultConfig = getDefaultConfig(__dirname)

defaultConfig.resolver.assetExts.push('cjs')

module.exports = defaultConfig

firebase.js

import { initializeApp } from 'firebase/app'
import { getFirestore } from 'firebase/firestore'
import { getStorage } from 'firebase/storage'

const firebaseConfig = {
  apiKey: '...LZs3kuQXu7oAoxXiA',
  authDomain: '...5.firebaseapp.com',
  projectId: '...5',
  storageBucket: '...5.appspot.com',
  messagingSenderId: '...89',
  appId: '...a2ea19cec',
  measurementId: '...7RV'
}

const app = initializeApp(firebaseConfig)

const db = getFirestore(app)
const storage = getStorage(app)

export { db, storage }

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments