Nakul Upadhya
Nakul Upadhya

Reputation: 488

Can't resolve firebase config file React

I'm new to React and I'm trying to create a Firebase web app using it. When I created my initial build, I put my firebase configuration in a separate js file from my app. When I try and run npm start to test it, I get the following error:

./src/Login.js
Module not found: Can't resolve 'firebaseConfig' in 'C:\Users\...\...\...\...\src'

The file in question is below:

import * as firebase from "firebase/app";
import "firebase/auth"
import React from "react";
const config = {
    //relevant configuration details
};
const firebaseApp = firebase.initializeApp(config);

export default firebaseApp;

I'm using it in other js files via

import React, {Component} from 'react';
import firebaseApp from "firebaseConfig";

I've tried deleting the file and rewriting it. I've checked my directories to make sure I have the correct dependencies and the firebaseConfig file is in the same folder as the Login file. I'm stuck. Does anyone know how I can fix this?

Upvotes: 1

Views: 874

Answers (1)

Michael
Michael

Reputation: 1872

You should use: import firebaseApp from "./firebaseConfig"

Upvotes: 1

Related Questions