Module not found: Can't resolve 'firebase' in
12,454
npm i firebase
now installs v9 Modular SDK so you cannot used the old imports. Try refactoring your code to this:
import { initializeApp } from 'firebase/app';
const firebaseConfig = {
//...
};
const app = initializeApp(firebaseConfig);
If you want to use older syntax then change your imports to compat libraries:
import firebase from "firebase/compat/app"
import "firebase/compat/auth"
import "firebase/compat/firestore"
// other services is needed
You can read more about it in the documentation
Author by
Digamber negi
Updated on June 15, 2022Comments
-
Digamber negi almost 2 years
After: npm i firebase
I'am importing firebase from firebase itself & not from a file
import firebase from 'firebase'; >in firebase.js file<
error in terminal>> ./src/firebase.js Module not found: Can't resolve 'firebase' in 'C:\Users\Home\Documents\dsn\e\Documents..........'
-
Digamber negi over 2 yearsI' am already updated to v9 and "firebase/compact/app" do worked for me.✔
-
Admin over 2 yearsYour answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
-
viana about 2 yearsIt worked for me. Tks