[Problem Solving] ./src/firebase.js Attempted import error: 'firebase/app' does not contain a default export (imported as 'firebase').



import firebase from "firebase/app";

const firebaseConfig = {
    ~~~
};

// Initialize Firebase
export default firebase.initializeApp(firebaseConfig);

When i use this code, there is a error. This issue is caused by firebase.

./src/firebase.js Attempted import error: 'firebase/app' does not contain a default export (imported as 'firebase').

In my case, i use under solution. I change “firebase/app” -> “firebase/compat/app”. And this solve the problem. Because of firebase version, this problem arised.

// import firebase from 'firebase/app'; //old version
import firebase from 'firebase/compat/app'; //v9

You can solve problem using this! Or, you can try downgrade firebase version.