有人能帮我写这段代码吗?我正在尝试用React和firebase认证做一个网站项目。当我尝试运行这段代码时,React显示一个错误=〉Module not found:错误:未从包中导出包路径
import firebase from "firebase";
const firebaseConfig = {
apiKey: "...",
authDomain: "...",
projectId: "...",
storageBucket: "...",
messagingSenderId: "...",
appId: "...",
measurementId: "..."
};
const firebaseApp = firebase.initializeApp(firebaseConfig);
const db = firebaseApp.firestore();
const auth = firebase.auth();
const provider = new firebase.auth.GoogleAuthProvider();
const storage = firebase.storage();
export { auth, provider, storage };
export default db;
我已经多次尝试更改import语句,但没有效果
1条答案
按热度按时间h43kikqp1#
如果是版本8之前的版本,请尝试以下操作:
import firebase from 'firebase/app';
作为Firebase导入。版本9及以上:
import firebase from 'firebase/compat/app';