Replies: 5 comments 37 replies
-
@StokleyO there's not enough information here to tell where things might be going wrong. Can you share a repository that reproduces the error? |
Beta Was this translation helpful? Give feedback.
-
@saschakrueger have you managed to solve the prop src issue? I'm struggling with the same, reported here: Thank you! |
Beta Was this translation helpful? Give feedback.
-
After 10+ different errors I'll just remove this and stick to optimizing assets myself. This does not seem like a stable, production-ready tool right now. |
Beta Was this translation helpful? Give feedback.
-
It seems dynamically importing images for <enhanced:img /> tag has very limited functionality. If you import an image, consider to use if condition before using the image in the html as below:
This worked for me. But it is best to use static images directly on enhanced:img tag, because it allows setting the dimensions of the image and you get the actual resized images. Using css to adjust width and height doesn't seemed to actually resize the image. It happened in my case, you may directly check yourself. Do let us know what have you discovered. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey everyone,
I've recently begun attempting to use Svelte's new enhanced:img feature as described here (https://kit.svelte.dev/docs/images#sveltejs-enhanced-img), however, I am not getting the desired results. After running the function to install @sveltejs/enhanced-img and adding enhancedImages to my vite.config.js file, anytime I try to use the <enhanced:img /> tag, I get an error saying 'Cannot read properties of undefined (reading 'src')'. Then also, when I try to add ?enhanced to the end of my dynamic photo import, I get an error that says no such file exists and then it shows me the exact path to get to the file. Anyone been able to implement this successfully yet? The specific image here is a png file. And I'm using SvelteKit 1.20.4 and Svelte 4
Beta Was this translation helpful? Give feedback.
All reactions