-
Notifications
You must be signed in to change notification settings - Fork 373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug?]: baseURL issues for nested urls + static builds #1246
Comments
Related
|
One of the issues here is that when you use lowercase 'a' tags, they are not able to read the base path from the context and then rewrite the url to include that. So they just stay the way they were written. I think you can try using uppercase 'A' component from the router and that should be base path aware |
thanks @nksaraf , that does indeed fix the link. This error still persist when I try to preview my build: GET http://localhost:3000/offset/_build/assets/HttpStatusCode-6f2232a6.js net::ERR_ABORTED 404 (Not Found) |
Okay so during the preview of the static build, we need to a way to do it at the |
Adding a So we'll relace the preview command from |
Interesting! I look forward to trying it out when it's released. |
its released |
@nksaraf I've tried to get this working, but I'm unable to get the preview behaving as I want, and I'm a bit at a loss now regarding which of these I can use in combination. Just to clarify, these are the places I can set a base path:
If I only use no. 1, my dev server behaves well - It injects the base in the The two errors i most often see in my attempts to get the preview working, apart from incorrect links, are generally:
and
|
This is how remix does it: |
Okay, we're now on solid-start 0.6, and vinxi 0.3.5. I've updated everything and picked this up again. If I have a app.config.js that looks like this: const config = defineConfig({
ssr: false,
server: {
preset: 'static',
experimental: {
asyncContext: true
},
baseURL: 'http://localhost:3000/maplibre-style-spec/',
}
}); Then I'll get a warning saying: vinxi v0.3.5
vinxi starting dev server
(!) "base" option should start with a slash. This warning I think I'm not interested in baseUrl affecting the dev server - at least dev mode works perfectly when it's unset |
Yeah i think im myself a bit confused about how to resolve this. There are a bunch of places where base would get used and Im not sure what people intend with all the variations. |
Okay, i understand. It is quite hairy. Is it possible to untangle the vinxi internal base (the _build) so it doesn't influence any of the config parameters like vite.base? The reason for setting a base in the app.config (normally vite.base, but now server.baseUrl) would be to designate nested public path and thus where a link would point if it's set to just "/", to find the public folder and entry scripts etc. That is a true base. The current baseUrl is problematic because it doesn't apply the path defined to the current domain, it overwrites it completely. If my dev server (or preview) is localhost:3000, and baseUrl is "/offset", it should make all the links "localhost:3000/offset", not just "/offset" which is does currently and breaks all anchors. The parameter set on the router is to my understanding nothing more than an alternative to putting the routes in subfolder hierarchy and let the file router apply this extra path. It doesn't touch the asset path or anything like that. This base should be further appended behind the baseUrl. So in total the And the public path would be just: What other use cases could there be? |
@ryansolid this is hairy, but if start is at the "no more shrugging" state it really would be good to have this common use-case worked out for the 1.0 the ability to deploy to a nested url path, as it's possible with all the other popular meta frameworks. |
I'm not clear what should be changed. The router is only going to accept one base path so we just need to make sure it gets the right one. Generally it ignores the host/domain:port.. so it just needs to be fed the the rest I think. I would assume that if the router had issues here we would have had complaints earlier. So is the problem what we get from SolidStart? |
I think the issue originates in vinxi, and the way it integrates with solid-start/router. At the end of the day the dx (build previews) and feature set (deployment) of SolidStart is affected by this issue. There is no static example in vinxi i can use to narrow part of the issue down, and it would also not fully capture the interplay with the solid-router |
I guess what I don't understand on the Solid router side is why would |
I think what would help me is a checklist/table of combination of flags (server.baseURL) and what you expect to happen with I can then go thru that checklist and get it all working. It's all too abstract for me to know what I need to change/fix. |
Alright, good idea, I'll try to come at it from a different angle. |
Duplicates
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 runningnpx 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.: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. thenode-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:
and the router got added this:
Context 🔦
extending the good work described here to nested urls
Your environment 🌎
The text was updated successfully, but these errors were encountered: