我有以下结构(处理不同的主题)使用Firebase上的不同网站。
/src
/theme-1/index.html
/theme-2/index.html所有的“果汁”都在src中,文件index.html对于theme-1和theme-2都是相同的,除了我引用.css文件的那一行,我实际上使用了一个不同的on。
目前,我只配置了一个目标,但我将在firebase.json中添加更多目标
{“托管”:{
"target": "theme-1",
"public": "theme-1",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{"source": "**","destination": "/theme-1/index.html"}
],
"cleanUrls": true,
"headers": [ {
"source": "**",
"headers": [ {
"key": "Cache-Control",
"value": "max-age=60"
} ]
} ]
}}
然后,我使用cmd命令配置我的目标以指向我的firebase站点:
firebase target:apply hosting theme-1 theme-1并随后部署网站:
firebase deploy然而,当我访问该页面时(尽管它在本地工作),它似乎无法找到根文件夹/src (404错误)。
如何将文件夹/src也包含在我的展开中,使其以相同的方式工作?
发布于 2020-01-17 05:14:49
只有由public指定的目录才会部署到Firebase。这个名称有点误导,因为没有“私有”文件/目录。
因此,您必须执行"public": "src" (如果您还想部署theme目录,则执行"public": "." ),并相应地调整其他属性。
https://stackoverflow.com/questions/57730235
复制相似问题