Closed DirtyHerby closed 1 year ago
Need more details. Can you post your code?
Sure,
first I installed the package, I added imagetools plugin into my vite.config.js and add a component:
Can't see your attached image. But can you run
console.log(ImgDesignTop)
and see what it says?
At the moment i get a 500 error. When I comment out "import Img from...", the console shows me /src/lib/assets/images/jpg/AdobeStock_87816499_Preview.jpeg?run
The path is converted correctly.
So I can't replicate it, but I suspect there's an issue with your image import. If you could create a minimal reproduction in https://node.new/sveltekit it'll be much easier for me to help.
I realised reproducing in Stackblitz wouldn't work because it can't install Sharp (the image transformation engine) dependencies.
At the moment i get a 500 error. When I comment out "import Img from...", the console shows me /src/lib/assets/images/jpg/AdobeStock_87816499_Preview.jpeg?run The path is converted correctly.
If importing the image returns just a path to that image, then that's wrong. It means imagetools
is not picking up the image (and transforming it) correctly. I'll double-check on your installation, as well as your vite.config.js
.
The plugin works and I get the correct output. Thank you for your help. I added the dependencies ("imagetools-core" and "vite-imagetools") to my package.json.
Strange - imagetools-core
and vite-imagetools
should automatically be installed if you install the @zerodevx/svelte-img
package. Normally I wouldn't recommend adding these two yourself so that svelte-img
can control the versioning. In any case, glad you got the setup working.
Hi,
I get the error:
TypeError: src.reduce is not a function at SvelteImg.svelte:22:29 at Object.$$render (/node_modules/svelte/internal/index.mjs:1892:22)
Best, Tim