【问题标题】: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 文件?

【问题讨论】:

  • 这是 SPA 还是静态网站?

标签: 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

【讨论】:

  • 您的答案可以通过其他支持信息得到改进。请edit 添加更多详细信息,例如引用或文档,以便其他人可以确认您的答案是正确的。你可以在in the help center找到更多关于如何写出好的答案的信息。
猜你喜欢
  • 2021-09-21
  • 2020-06-01
  • 2020-06-16
  • 1970-01-01
  • 2017-10-31
  • 2020-07-14
  • 2012-01-15
  • 2022-07-10
  • 2020-12-03
相关资源
最近更新 更多