使用Firebase部署SPA和功能

问题描述

我有一个React应用,它消耗了Firebase(firestore)后端。 我还使用Firebase托管来托管SPA。我的firebase.json:

{
  "firestore": {
    "rules": "firestore.rules","indexes": "firestore.indexes.json"
  },"hosting": {
    "public": "build","ignore": [
      "firebase.json","**/.*","**/node_modules/**"
    ],"rewrites": [
      {
        "source": "/","destination": "/index.html"
      },{
        "source": "/app/**","function": "app"
      }
    ]
  },"storage": {
    "rules": "storage.rules"
  },"emulators": {
    "functions": {
      "port": 5001
    },"firestore": {
      "port": 8080
    },"hosting": {
      "port": 5000
    },"ui": {
      "enabled": true
    }
  },"functions": {
    "source": "functions","predeploy": [
      "npm --prefix \"$RESOURCE_DIR\" run lint"
    ]
  }
}

因此,现在我测试了一些功能,并希望部署它们。 (我有一个functions目录,其中包含package.json,node_modules和index.js,其中包含函数。)如果我只运行firebase deploy,它将仅从build文件夹部署该版本。>

我的问题是:

  • 我可以使用同一个firebase项目部署SPA和功能吗?
  • 如果是,我在做什么错?
    • 如何指定要运行功能的端口?
    • 或者我应该使用路由参数还是其他?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)