【问题标题】:How to deploy next.js webapp with firebase multi site hosting?如何使用 firebase 多站点托管部署 next.js webapp?
【发布时间】:2019-10-01 10:35:43
【问题描述】:

我尝试使用 firebase 多站点托管部署 next.js 应用程序,但我无法理解文件夹结构将是什么以及它是如何完成的,所以任何人都可以提供帮助? 到目前为止,我已经创建了一个 src 文件夹,其中有一个公用文件夹、一个函数文件夹和应用程序文件夹,其中有两个文件夹 admin 和 customer,所以我该怎么做。请建议提前致谢。

【问题讨论】:

    标签: firebase express google-cloud-functions firebase-hosting next.js


    【解决方案1】:

    您可以为每个站点单独配置一个 Firebase 托管配置,这样您的每个 publicadmincustomers 站点/文件夹都有一个 firebase.json,或者您可以将它们组合起来变成一个firebase.json

    对于后者,您可以在项目的顶层定义 firebase.json,如下所示:

    {
      "hosting": [ {
          "target": "public",
          "public": "src"
    
          // ...
    
          "rewrites": [...] // You can define specific hosting configurations for each site
        },
        {
          "target": "admin", // "app" is the applied target-name for the Hosting site myapp-app
          "public": "app/admin",
        },
        {
          "target": "customers",
          "public": "app/customers",
        }
      ]
    }
    

    然后您可以使用firebase deploy 部署所有站点,或使用firebase deploy --only hosting:admin 部署特定站点。

    define the hosting configuration for each site

    【讨论】:

      猜你喜欢
      • 2019-02-09
      • 2019-10-10
      • 2021-03-24
      • 2019-07-03
      • 2020-05-30
      • 2020-10-26
      • 1970-01-01
      • 2019-11-29
      • 2015-04-18
      相关资源
      最近更新 更多