-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
$page.url.pathname
represented as "//prerender/" when building using the static adapter
#3164
Comments
I've run into the exact same issue. I added hydrate: false to svelte.config.js kit: { but while the above workaround fixed the pathname issue it broke other functions such as click handlers. So I have tried ssr: false and so far this does not result in any problems as far as I can tell. |
I've found the same with both the nelify and vercel adapters. Essentially any page that I am prerendering seems to have this issue |
Note: I've tested
So this behaviour would technically work in Safari, though I'm not sure who's correct here. A easy fix is to have the protocol to be something like |
Looks like this is closed and merged, but I'm still experiencing this on sveltesirens.dev. I was programmatically grabbing the title from the pathname, but had to change it due to this bug. I have a console.log running |
Apparently I was missing the forward |
I noticed it in version |
Well I have to correct myself:
start({
target: document.querySelector("#svelte"),
paths: {"base":"","assets":""},
session: {},
route: true,
spa: false,
trailing_slash: "never",
hydrate: {
status: 200,
error: null,
nodes: [
import("/_app/pages/__layout.svelte-0057c1c3.js"),
import("/_app/pages/_lang_/__layout.svelte-e41373d5.js"),
import("/_app/pages/_lang_/index.svelte-5ab6d11c.js")
],
url: new URL("http://prerender/de"),
params: {lang:"de"}
}
}); |
This is normal as it's a valid URL. You can paste @brittneypostma Can you confirm this is still an issue in the latest SvelteKit version? |
Yes, this is same thing I am experiencing on sveltesirens.dev, I have a console.log running the |
Ah I didn't notice the
The I tried to spin up the svelte sirens repo locally too, but I'm getting |
I updated the repro to use the latest SvelteKit (v1.0.0-next.231) and also added After building using the static adapter, I see "/" in the console, as expected. |
Same here, after updating to latest, this issue seems to have been resolved. |
Also seeing the same issue but with My issue was closed very fast though, so not sure what to do, this seems like a bug too me |
Describe the bug
Using the latest versions:
In development,
$page.url.pathname
inroutes/index.svelte
will correctly be displayed as "/".However, when building for production using the static adapter, the same route is represented as "//prerender/".
Inspecting
build/index.html
, the markup has the correct "/" but the script that hydrates the markup has the following:Evaluating
new URL("sveltekit://prerender/")
shows that theURL.pathname
is//prerender/
.Workaround
A workaround is to explicitly set
kit.ssr
orkit.hydrate
tofalse
.Reproduction
https://github.com/metonym/sveltekit-page.url.pathname
Logs
No response
System Info
Severity
blocking an upgrade
Additional Information
No response
The text was updated successfully, but these errors were encountered: