【发布时间】:2020-05-04 13:52:19
【问题描述】:
我正在尝试在我的项目中使用 firebase google 身份验证,但在编译时出现此错误:
./src/firebase/firebase.utils.js 未找到模块:无法解析“C:\Users...”中的“firebase”...
这是我的 firebase.utils.js:
import firebase from 'firebase/app';
import 'firebase/firestore';
import 'firebase/auth';
const config = {
apiKey: "AIzaSyCcqIv_fjH5LTw7A6Q9hjevJfGTmN3nIqk",
authDomain: "crwn-db-4b7c9.firebaseapp.com",
databaseURL: "https://crwn-db-4b7c9.firebaseio.com",
projectId: "crwn-db-4b7c9",
storageBucket: "crwn-db-4b7c9.appspot.com",
messagingSenderId: "659711574442",
appId: "1:659711574442:web:1e28381cc2890ad32aabd3",
measurementId: "G-0B6V9D8PRK"
};
firebase.initializeApp(config);
export const auth = firebase.auth();
export const firestore = firebase.firestore();
const provider = new firebase.auth.GoogleAuthProvider();
provider.setCustomParameters ({ prompt: 'select_account' });
export const signInWithGoogle = () => auth.signInWithPopup( provider );
export default firebase;
然后我在我的登录组件中导入了 signInWithGoogle 函数。
有谁知道问题出在哪里?我哪里错了?
【问题讨论】:
标签: reactjs firebase google-authentication