在单个项目firebase

时间:2018-03-18 14:35:20

标签: angular firebase angular5 firebase-hosting

所以我在firebase托管下部署了一个角色5应用程序,域名为 www.mydomain.com 。现在我还有一个角度5应用程序连接到同一个项目,我将其视为管理面板,并希望在子域下部署 - www.admin.mydomain.com

我已经为各个域正确配置了TXT个记录,当我同时点击URLs时,它将显示第一个项目内容。

我的第一个申请firebase.json如下:

{
    "hosting": {
        "public": "dist",
        "ignore": [
            "firebase.json",
            "**/.*",
            "**/node_modules/**"
        ],
        "rewrites": [{
                "source": "**", //for any route request
                "destination": "/index.html"
            },
            {
                "source": "https://admin.mydomain.com/**", //specific to this request
                "destination": "/admin/index.html"
            }
        ]
    }
}

第二个应用程序的构建输出目录将位于第一个应用程序的dist目录中,并且这两个项目在我的系统中处于同一级别。

第二个应用的angular-cli.json包含"outDir": "../firstapp/dist/admin",

因此,一旦两者都构建并放置在第一个项目应用程序的dist目录中,我就已经成功部署了它。

但是,当我浏览2个不同的URL时,它总是提供来自第一个应用程序的页面,admin文件夹下的dist目录永远不会被考虑。

项目的内置版本具有以下结构

-dist
   -admin
       -index.html
       -inline.370847efdcd50e26c23c.bundle.js
       -main.ff340c7513400e78d233.bundle.js
       -polyfills.32225f5d64cec6731cb0.bundle.js
       -styles.d41d8cd98f00b204e980.bundle.css

   -index.html
   -inline.09d20b30b3c5121cfc56.bundle.js
   -main.c97b32660a6d046955c8.bundle.js
   -polyfills.1364aed46b3c77673c40.bundle.js
   -styles.2926c591943e8077f48a.bundle.css

我认为下面的重写条目将确保从admin目录下的dist目录中提供来自admin.mydomain.com的所有请求的内容。

"source": "https://admin.mydomain.com/**", //specific to this request
"destination": "/admin/index.html"

有人可以澄清一下我在这里假设或做错了什么以及如何实现这个目标?

0 个答案:

没有答案