0
votes

Project Directory image

I am trying to import firebase in my react app, using the following syntax:

import {auth} from '../firebase/config

But I am facing following issue:

./src/Pages/Login/Login.js Module not found: Can't resolve '../firebase/config'

this is my config file

import * as firebase from '/firebase/app' import 'firebase/auth'; import 'firebase/firestore'

// Firebase configuration const firebaseConfig = { apiKey: "", authDomain: "", projectId: "", storageBucket: "", messagingSenderId: "*****", appId: "******" };

// Initialize Firebase firebase.initializeApp(firebaseConfig);

const firestore =firestore.firestore(); const auth = firebase.auth();

export { auth, firestore };

thanks for your help in advance

1
Please share a screenshot of your directory structure. - Dharmaraj
Hi, please find attached project directory image.Thanks! - Archana
Hello, if my answer was useful you can accept (✔) and upvote (🔼) it. Feel free to ask further questions. - Dharmaraj

1 Answers

0
votes

Your path is incorrect. '../firebase/config' will look for the config file in src/Pages/firebase but the config is present in src/firebase. Try this path instead:

import {auth} from '../../firebase/config'
//                  ^^