Open CordlessWool opened 2 years ago
It would be helpful to know if this happens with a plain Vite project or only with SvelteKit: https://github.com/sveltejs/kit#bug-reporting
What I currently know is that it didn't happen with a version of sveltekit before 39x. I do not have the exact version in mind.
I tried to rebuild it with vite vanilla, but I never did a project with vite beside svelte kit so I am not sure if I test it correctly, but I didn't get an error.
I created a project with npm create vite-extra@latest -- --template ssr-svelte
Afterwards I added a route in server.js for GET requests on /images
and I created a folder images
in public. It toke the server route and didn't throw an error. So for me it looks like everything is ok in vite.
I'm pretty sure this is a Vite issue - our code correctly determines that this is not a static asset since it's a directory, then calls the next
middleware which happens to be Vite's which then throws the error.
Describe the bug
In the project, I have a route and a folder in static with the same name (images). Loading
images/someimage.jpg
working well, but accessing justimages?somepaream
produce an error.Failed to load url /images?load=%2Fimages%2Fteaser.jpg (resolved id: /images?load=%2Fimages%2Fteaser.jpg). This file is in /public and will be copied as-is during build without going through the plugin transforms, and therefore should not be imported from source code. It can only be referenced via HTML tags.
Seems relating to https://github.com/sveltejs/kit/issues/5672 but in a more special way. After build there is no problem, only in dev mode I get this error.
Reproduction
https://stackblitz.com/edit/sveltejs-kit-template-default-yefxpo?file=src/routes/index.svelte
Logs
System Info
Severity
serious, but I can work around it
Additional Information
No response