我按照所有必要步骤将自己的Angular2网站托管在Firebase上
firebase login
firebase init (single page app replace index.html file YES)(folder public)
firebase deploy
但是我的网站仅包含Welcome模板(Welcome Firebase托管设置完成...)
我尝试删除/替换/自定义公用文件夹中的index.html文件,但是欢迎模板仍然存在...
如何用我自己的网站替换此模板?
firebase.json的内容:
{
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
答案 0 :(得分:0)
您hosting
中的firebase.json
指向错误的目录。
如果您进行构建,并且目标是location/of/dist/folder
目录,则需要将firebase.json
更改为
{
"hosting": {
"public": "location/of/dist/folder",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**" ],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
您可以在.angular-cli.json
中检查构建目标(对于V6,则可以检查angular.json
)
"outDir": "location/of/dist/folder"
(或对于V6为"outputPath": "location/of/dist/folder"
)
此外,如果您在执行firebase init
之前已经构建了项目。如果必须index.html
被覆盖,应该会提示您。
您可以重新运行firebase.json
来代替编辑firebase init