Solid JS and Firebase hosting not showing routes

256 Views Asked by At

I'm trying out Solid. I hosted a simple web app on firebase that shows the index.html file, but only shows a 404 error for other routes. Solid JS stores its index.html folder in dist/public, along with other files.

404.html             favicon.ico          manifest.json        ssr-manifest.json
assets/              index.html           route-manifest.json

The routing works fine in my development server, but not on firebase or netlify. It looks like both firebase and netlify have config options that let you specify redirects, but what html file do I redirect to?

1

There are 1 best solutions below

1
On BEST ANSWER

If you ran firebase init your project should have a firebase.json. Here's an example from one of my projects. Notice the rewrites array. It says every link to my website should be handled by index.html, which is where React project is served from. Solid-js should work similarly

{
  "hosting": {
    "public": "build",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  }
}

Documentation here https://firebase.google.com/docs/hosting/full-config#rewrites