-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Svelte-Kit: Can't use Image component #109
Comments
Can confirm I get this also:
|
I am also trying to make it work with sveltekit. Anybody have a solution ? |
Same problem. This package is a deal maker/braker for Svelte, I should be in the official repo. My two cents, I guess the config file now looks more like: preprocess: preprocess({
...image()
}), |
@Antoine-lb would you able to make it work, or do we need to use other plugins like vite-image-tools ? |
@yiioverflow no, I wasn't able to make it work. I didn't try that hard but I ended up exactly where the this issue points to |
I fixed it by adding // svelte.config.js
// ...
const config = {
// ...
kit: {
// ...
vite: {
optimizeDeps: {
include: ['blurhash'],
},
ssr: {
noExternal: ['svelte-image'],
},
},
},
}; Also, the preprocess statement has to look like the following: import preprocess from 'svelte-preprocess';
import svelteImage from 'svelte-image';
const config = {
preprocess: [
preprocess({ /* options */ }),
svelteImage(),
],
// ... Note that there is a difference between However, with my project running TypeScript, I couldn't get it to work, as |
@QElix thanks for sharing! There's a PR for |
Hi, I just merged the woltapp/blurhash#58 PR and release 1.1.4 of the package, so you should be able to move forward with this. |
Thanks @omahlama! However, it looks like there's another issue: woltapp/blurhash#142 |
Things works fine for me in both dev and build mode. @Antoine-lb thanks for the config file guess seems you are correct.
Update: But there seems to be something odd going on in prod build, if I am to reload the page with image image disappears., but If I navigate to another link and came back to the page with image, image is shown. May be this is a bug with Svelte kit Static adapter. paging @benmccann |
Is the typescript issue solved for now? I have the same error, pointing to type declaration. |
I've sent a fix for the |
I just tested with the latest version of |
@benmccann's PR seems to fix it when using Javascript, but it's still giving me a parse error when using typescript. I put a minium reproducible example, and was wondering if anyone had any idea how I could go about fixing this.
|
Hi,
Firstly thanks for making this great library. I'm trying to get to get it setup with Svelte-Kit however importing
Image
gives me this error:ENOENT: no such file or directory, open '/Users/richard/Documents/Personal sites/r-bt.com/node_modules/blurhash/src/index.ts'
Steps to reproduce
svelte-image
tosvelte.config.cjs
Image
componentThe text was updated successfully, but these errors were encountered: