【发布时间】:2020-07-19 02:35:56
【问题描述】:
我是第一次使用 Firebase,我部署了一个我知道可以正常工作并托管在 github 页面上的 react 应用程序。我按照 Firebase 文档提供的说明将应用程序部署到他们的网站。在加载网站时,我看到一个空白页面。
链接:https://monsterpwa.web.app/
firebase.json 文件:
{
"hosting": {
"public": "build",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
这里之前的帖子都是关于更改为构建的公共部分。除此之外,我找不到其他有类似问题的人。
控制台记录和错误,在第一行第 1 列中存在意外标记“
清单文件:
{
"short_name": "Monster App",
"name": "Monster App D&D Spells and Items",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "/public/media/800x800.png",
"type": "image/png",
"sizes": "800x800"
}
],
"start_url": "./index.html",
"display": "standalone",
"background_color": "#2d4059;",
"theme_color": "#2d4059",
"orientation": "portrait-primary"
}
构建
Build
--> Media -- > *empty*
--> static -- > css / js --> each contains two files. main.7bf83f0f & the map version & main.3267ab84 and the map version.
asset-manifest.json
favicon.ico
index.html
manifest.json
service-worker.js
worker.js
亲切的问候,
雪
【问题讨论】:
-
哪个文件给您带来了意外的令牌错误?您是否尝试过将其设置为公开而不是构建?
-
点击控制台中的链接。您的
main.js文件实际上正在加载index.html内容 -
您能展示一下您的
build目录的内容是什么样的吗? -
抱歉,jamargolisvt,我没想到会这么快得到回复,stackoverflow 上有答案,我应该将其设置为公开,我将尝试将其设置为公开并发布我的情况。 @Phil 我发现也是如此,但我不知道为什么..当然我会在编辑中添加它。
-
我把上面的构建放在一个编辑中,因为它在回复部分不可读
标签: reactjs firebase firebase-hosting