-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Handle entries
when +page.ts
are +server.ts
in the same directory.
#9929
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
Comments
Okay, this is weird. I can clearly see that the prerendered content folder isn't being created in the StackBlitz repository, but whenever I try to reproduce this locally, it works just fine. Can you do me a favor and try to reproduce this with a GitHub repository and share the link? As for the second part, this is expected -- SvelteKit checks I think the action items here are:
|
Created a reproduction repository. Please check the commits that start with the message
|
For additional context, I have stumbled upon this issue in the following real-world example. Reproduction /src/routes/[artist]/[release]
# Both of these pages (artist and artist's release)
/younha
/younha/end-theory
# Request the following JSON endpoint using content negotiation.
# https://kit.svelte.dev/docs/routing#server-content-negotiation
/younha Note that the pre-rendering is disabled in // Error: Cannot save /younha/end-theory-final-edition as /younha is already a file.
export const prerender = false; I believe fixing the first part of the issue will fix this reproduction as well.
The above behavior is expected, since the following files are generated. tree .svelte-kit/output/prerendered
.svelte-kit/output/prerendered
└── pages
└── younha # pre-rendered +server.ts
2 directories, 1 file Worked around this issue by renaming the server endpoint as guided. - src/routes/[artist]/+server.ts
+ src/routes/[artist].json/+server.ts |
Okay, just categorizing a few things here for notes:
Investigating cause |
Figured it out! Only took two hours I made an error earlier (I think? we'll see what Rich says) -- the precedence of I noticed a potential separate issue here, though, which I'll file a separate issue about. |
Update: New issue has been created. #9995 It would be nice if these information are documented.
Providing relevant type or build errors would be nice if multiple |
Yep, I'm making a followup issue for throwing an error if multiple |
Per #9994 (comment), I think we should just error if |
I agree that multiple Not because there are no use cases for it - reference #9929 (comment) ├── +page.svelte
├── +page.ts # Fetches the following JSON endpoint using content negotiation
└── +server.ts # Shared, common JSON endpoint that can be used by other routes but because content negotiation cannot be done using simple static file serving. For example in Cloudflare Pages, it will require Workers invocation which is not free. I just hope that the error is shown before build to avoid last minute fixes. |
Closed via #11256, having conflicting route definitions / both a |
Describe the bug
In the following setup,
the pre-rendering and production router are broken.
/1
+page.svelte
rendered404 Not Found
npm run build && tree .svelte-kit/output/prerendered .svelte-kit/output/prerendered [error opening dir]
Reproduction
Reference the StackBlitz project.
Currently, removing the
+server.ts
file seems to be the only solution.An empty
+server.ts
does not work either.Logs
No response
System Info
Severity
serious, but I can work around it
Additional Information
If the
+server.ts
exportsentries
,only this gets pre-rendered.
/1
+page.svelte
rendered404 Not Found
/2
+page.svelte
rendered{"slug":"2"}
npm run build && tree .svelte-kit/output/prerendered .svelte-kit/output/prerendered └── pages └── 2
The text was updated successfully, but these errors were encountered: