【问题标题】:Solid JS and Firebase hosting not showing routesSolid JS 和 Firebase 托管不显示路线
【发布时间】:2023-02-07 07:57:08
【问题描述】:
我正在尝试 Solid。我在 firebase 上托管了一个简单的网络应用程序,它显示了 index.html 文件,但只显示其他路由的 404 错误。 Solid JS 将其 index.html 文件夹与其他文件一起存储在 dist/public 中。
404.html favicon.ico manifest.json ssr-manifest.json
assets/ index.html 路由清单.json
路由在我的开发服务器上工作正常,但在 firebase 或 netlify 上不行。看起来 firebase 和 netlify 都有允许您指定重定向的配置选项,但是我应该重定向到哪个 html 文件?
【问题讨论】:
标签:
firebase
routes
netlify
solid-js
【解决方案1】:
如果你运行了 firebase init,你的项目应该有一个 firebase.json。这是我的一个项目中的示例。注意重写数组。它说我网站的每个链接都应该由 index.html 处理,这是 React 项目的服务来源。 Solid-js 应该类似地工作
{
"hosting": {
"public": "build",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
文档在这里https://firebase.google.com/docs/hosting/full-config#rewrites