I have a SvetleKit project where I want to add dynamic routes. It is my first big project where I use SvelteKit (it’s way better than React ;). Suppose I have a page on which a lot of objects are displayed in an overview and I want to add a detailed view of each individual object. For the summary I created a /src/routes/overview folder with a +page.svelte for the summary of all objects. For the detailed view, I have made a folder with square brackets around an ID and a +page.svelte, i.e. /src/routes/overview/[objectId]/+page.svelte. But no matter what I do, whenever I navigate to a dynamic route, the content of the +page.svelte in the [objectId] folder is not displayed on the page, but 404 NotFound. I didn’t put anything dynamic in the +page.svelte for testing purposes, only static “HTML”.
I already tried all the standard tips – deleting node_modules and reinstalling, deleting .svelte-kit and restarting, let the project build and run with the preview instead of just the development mode, used the node-adapter instead of the auto-adapter, tried to rename the folder for the dynamic ID, but nothing worked (I’m desperate). I already had the problem of 404 Not Found pages with some statically named folders, but there the problem was gone after I deleted the .svelte-kit folder once and restarted it.
I only use the server component of SvelteKit for the benefits of SSR, the API for the project itself is a completely different project (ASP.NET Core), so it is not requests to the API that are not found, the route itself is not recognized.
I’m using SvelteKit in version 2.5.10