运行时出现此错误npm run dev
registerFunctions(firebase$1, fetch.bind(self));
^
ReferenceError: fetch is not defined
我认为rxfire不会导入 fetch,所以我将此行添加到src/server.ts
global['fetch'] = require('node-fetch');
错误仍然存在,有什么建议吗?我想我根本不需要添加这个。
我只是在src/ firebase.ts 文件中使用rxfire ,如下所示:
import firebase from "firebase/app";
import "firebase/auth";
import "firebase/firestore";
import "firebase/functions";
import * as config from "./config.json";
firebase.initializeApp(config);
export const auth = firebase.auth();
export const googleProvider = new firebase.auth.GoogleAuthProvider();
export const db = firebase.firestore();
export const functions = firebase.functions();
谢谢,
J