'Firebase Import Error : initializeApp was not found in firebase/app

I am building my first firebase app using JS and Webpack. I'm following the modular approach. I have followed the documentation and forums for this, However I cannot seem to get my imports to work. This is the error I keep getting :

    WARNING in ./src/index.js 12:12-25
export 'initializeApp' (imported as 'initializeApp') was not found in 'firebase/app' (possible exports: default)

The import is in Index.js as :

import { initializeApp } from "firebase/app";

I have followed a few tutorials on Youtube, the official documentation step by step, over and over, and forums as well. Kindly help this newbie get started. Any suggestions or advice will be appreciated. Thanks.



Solution 1:[1]

I solved the problem changing:

import { initializeApp } from "firebase/app";

to

import firebase from 'firebase/app'

and using

firebase.initializeApp(firebaseConfig);

instead of

initializeApp(firebaseConfig);

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sunderam Dubey