-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Labels
bugSomething isn't workingSomething isn't workingready to implementplease submit PRs for these issues!please submit PRs for these issues!vite
Milestone
Description
Describe the bug
Bug
If you import an image on the server (e.g. in an endpoint), the file path will point to a non-existent file.
import Image from '$lib/svelte-welcome.webp';
console.log(Image); // /_app/immutable/assets/svelte-welcome-c18bcf5a.webpWhen looking in /build/client/_app/immutable/assets folder, the file is not included.
Use case
- I am using
node-canvason the server and in this case, I need to place an image on the canvas, so I need the image path - This is not an asset that I want to share publically, which is why I don't want to have it in the
staticfolder
Reproduction
https://stackblitz.com/edit/sveltejs-kit-template-default-eromzr?file=src/routes/todos/_api.js
- Run
npm run build - Run
node build - Click on the "Todos" link
- See image path in the console
Logs
No response
System Info
This command doesn't seem to work on StackBlitz 😄Severity
serious, but I can work around it
Additional Information
I guess I can work around it by having all assets in the static folder, which is included in the build correctly.
But then all the assets are public. So then I guess I can have some sort of logic in hooks.ts that would prevent access to those files.
gyurielf, lhoang, gentlemanjohn, umwwwelt and henrystollumwwweltumwwwelt and gentlemanjohn
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingready to implementplease submit PRs for these issues!please submit PRs for these issues!vite