ReactJs 中的 Firebase 错误
Firebase errors in ReactJs
正在尝试使用 Firebase Analytics 和 Cloud FireStore...我已将其提交到 FireStore,但我不确定为什么会收到此错误:
错误
index.ts:79 TypeError: Cannot read property 'INTERNAL' of undefined
at index.ts:41
at index.ts:79
at firebase-analytics.js:1
at firebase-analytics.js:1
(anonymous) @ index.ts:79
(anonymous) @ firebase-analytics.js:1
(anonymous) @ firebase-analytics.js:1
index.ts:79 Uncaught Error: Cannot instantiate firebase-analytics.js - be sure to load firebase-app.js first.
at index.ts:79
at firebase-analytics.js:1
at firebase-analytics.js:1
Firebase 文件
import firebase from 'firebase/app';
import 'firebase/firestore';
import 'firebase/analytics';
const firebaseApp = firebase.initializeApp({
apiKey: 'XXXXXXXXXXXXXXXXXX',
authDomain: 'XXXXXXXXXXXXXX',
databaseURL: 'XXXXXXXXXXXXX',
projectId: 'XXXXXXXXXXXXX',
storageBucket: 'XXXXXXXXXXXXX',
messagingSenderId: 'XXXXXXXXXXXXX',
appId: 'XXXXXXXXXXXXX',
measurementId: 'XXXXXXXXXXXXX',
});
export const db = firebaseApp.firestore();
firebase.analytics();
将import firebase from 'firebase/app'
替换为import * as firebase from 'firebase/app'
正在尝试使用 Firebase Analytics 和 Cloud FireStore...我已将其提交到 FireStore,但我不确定为什么会收到此错误:
错误
index.ts:79 TypeError: Cannot read property 'INTERNAL' of undefined
at index.ts:41
at index.ts:79
at firebase-analytics.js:1
at firebase-analytics.js:1
(anonymous) @ index.ts:79
(anonymous) @ firebase-analytics.js:1
(anonymous) @ firebase-analytics.js:1
index.ts:79 Uncaught Error: Cannot instantiate firebase-analytics.js - be sure to load firebase-app.js first.
at index.ts:79
at firebase-analytics.js:1
at firebase-analytics.js:1
Firebase 文件
import firebase from 'firebase/app';
import 'firebase/firestore';
import 'firebase/analytics';
const firebaseApp = firebase.initializeApp({
apiKey: 'XXXXXXXXXXXXXXXXXX',
authDomain: 'XXXXXXXXXXXXXX',
databaseURL: 'XXXXXXXXXXXXX',
projectId: 'XXXXXXXXXXXXX',
storageBucket: 'XXXXXXXXXXXXX',
messagingSenderId: 'XXXXXXXXXXXXX',
appId: 'XXXXXXXXXXXXX',
measurementId: 'XXXXXXXXXXXXX',
});
export const db = firebaseApp.firestore();
firebase.analytics();
将import firebase from 'firebase/app'
替换为import * as firebase from 'firebase/app'