Module not found: Can’t resolve ‘firebase’ in react js

In my reactjs project I have installed firebase using ‘npm i firebase’. And inside of src folder I have created firebase.js file for firebase config.

import firebase from 'firebase'

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

firebase.initializeApp(config);

export default firebase

Even after installing firebase in my project. It gives error:

./src/firebase.js
Module not found: Can't resolve 'firebase' in '/home/rupak/Projects/web/firebasereact/src'

Can anyone find the problem?

Answer

Refer Firebase docs if you are using newer version initializeApp is moved to firebase/app package