solid-start: [Bug?]: baseURL issues for nested urls + static builds

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

I experience that when in dev mode the links break, because they don’t get the /offset/ path of the url added, when making a build, and running npx serve .output/public, the page can’t find a lot of resources, because it looks up this address where they don’t exist currently i.e.:

GET http://localhost:3000/offset/_build/assets/HttpStatusCode-6f2232a6.js net::ERR_ABORTED 404 (Not Found)

Expected behavior 🤔

I expected the link with relative urls to adjust to a base path, by prepending it.

I expected to have a way to preview the build locally, going to localhost/offset/, which works as expected when using i.e. the node-server preset.

Steps to reproduce 🕹

Stackblit: https://stackblitz.com/edit/github-o2jqvn?file=src%2Fapp.tsx

Here is a simple repro where I took the basic example where i just changed the vite.config to:

server: {
            baseURL: '/offset/',
            preset: 'static',
            prerender: {
                crawlLinks: true
            }
        }

and the router got added this:

        <Router
            base={import.meta.env.SERVER_BASE_URL}

Context 🔦

extending the good work described here to nested urls

Your environment 🌎

Darwin 23.2.0 arm64 arm

About this issue

  • Original URL
  • State: closed
  • Created 6 months ago
  • Comments: 18 (18 by maintainers)

Most upvoted comments

its released

Okay so during the preview of the static build, we need to a way to do it at the baseURL otherwise it correctly won’t work.