-
-
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
Setting trailingSlash = "always"
in layout with a srr = false
page causes 404 errors in prod
#13255
Comments
I'm not able to reproduce the issue by following the reproduction steps or through the Stackblitz example. Can you share another minimal reproduction that reproduces the issue? |
Sorry, I think I may have edited the StackBlitz project without realizing it after I posted this issue. I've updated the StackBlitz project again: Observe I've tested this in both Edge and Firefox. |
Also, I just realized my reproduction steps in the first post was wrong, it should be a |
Thanks. It seems the issue stems from SvelteKit thinking there's a server load when the trailingSlash option is set in a +page.server or +layout.server file due to this line:
Unfortunately, we can't just remove it because it's a fix from #10531 and #10475 |
Describe the bug
I have a project using
adapter-static
. I've set up the following in mysrc/+layout.server.js
file:(Unfortunately the hosting setup I'm using requires
trailingSlash
set to"always"
)If I have a route
src/foo/+page.svelte
that isn't able to be server side rendered, creating asrc/foo/+page.js
file and filling it with:will work fine in dev. But in prod (or using Vite's preview mode) the page 404s. The network inspector says it's failing to fetch something at:
This file doesn't exist in the build output, but for some reason the site is asking for it.
To my surprise, this also works for the route page, if it also disables SSR.
Removing the
trailingSlash = "always"
or thessr = false
options makes the site work again.Reproduction
Create a blank SvelteKit Project using
adapter-static
as it's output.Create a
src/+layout.server.js
file:Create a
src/+page.js
file:Run
npm run dev
. Observe that the page works fine in dev.Run
npm run build
andnpm run preview
. Observe that the page shows a 404 error.I have created a StackBliz project showing the effect
Logs
No response
System Info
Severity
serious, but I can work around it
Additional Information
No response
The text was updated successfully, but these errors were encountered: