相关疑难解决方法(0)

如何在 gatsby 中初始化 firebase?

我一直坚持在使用 Redux 和 Redux-saga 的 gatsby 应用程序中使 firebase 工作。我知道存在,firebase-sagas但我正在尝试不使用它。

我正在尝试通过以下方式初始化 firebase 身份验证:

import * as firebase from 'firebase/app';
import 'firebase/auth';

export const app = firebase.initializeApp(
  {
    apiKey        : "apiKey",
    authDomain    : "project.firebaseapp.com",
    databaseURL   : "https://project.firebaseio.com",
    projectId     : "project",
    storageBucket : "project.appspot.com",
    appId         : "appId"
  }

)

export const authRef = () => app.auth(); //also tried: firebase.auth() and firebase.auth(app)
//firebase.auth returns a function, but firebase.auth() throws error

Run Code Online (Sandbox Code Playgroud)

我有以下配置gatsby-node.js

const path = require('path');

exports.onCreateWebpackConfig = ({ actions, plugins, …
Run Code Online (Sandbox Code Playgroud)

firebase reactjs webpack react-redux gatsby

6
推荐指数
1
解决办法
1852
查看次数

标签 统计

firebase ×1

gatsby ×1

react-redux ×1

reactjs ×1

webpack ×1