[英]Angular2 hosting on Firebase
通過執行所有必要步驟,我在Firebase上托管了Angular2網站
firebase login
firebase init (single page app replace index.html file YES)(folder public)
firebase deploy
但是我的網站僅包含Welcome模板(Welcome Firebase Hosting Setup Complete ect ...)。
我試圖刪除/替換/自定義公用文件夾中的index.html文件,但“歡迎”模板仍然存在。
如何用我自己的網站替換此模板?
我的firebase.json的內容:
{
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
您在firebase.json
hosting
指向錯誤的目錄。 如果進行構建,並且目標是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"
(或"outputPath": "location/of/dist/folder"
V6)
另外,如果您在執行firebase init
之前已經構建了項目。 如果必須覆蓋index.html
應該會提示您。
無需編輯firebase.json
您可以重新運行firebase init
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.