-
-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to use in webcontainers #368
Comments
Interesting idea 🤔 which library would one use for this? And how would we allow users to choose which "backend" to use? |
The alternate library is called squoosh. I was thinking the option could be passed to the plugin during initialization |
Better might be if we could get a wasm version of sharp: stackblitz/webcontainer-core#147 (comment) |
I looked into warm builds of sharp at the beginning of this projects (actually for being able to create an interactive demo website) and IMO this would be the best option. |
Hmm, looks like squoosh is no longer maintained: https://www.npmjs.com/package/@squoosh/lib |
Ouf that's tough, so the only way forward here would be a wasm build of sharp I guess |
Figured out how to detect if we're running on webcontainers: https://github.com/stackblitz/viteconf/blob/main/nuxt.config.ts#L7-L17 Potentially we could use this to automatically choose another backend or just disable the plugin while logging a warning that we're doing so |
As of v0.33.0+ sharp provides prebuilt WebAssembly binaries and should Just Work on webcontainers (although there is a further possible improvement detailed at stackblitz/webcontainer-core#1236). |
It appears
next/image
can use squoosh or sharp. It would be nice if imagetools could as well. The motivation for this is that I'd love to include imagetools in the default SvelteKit template. However, sharp would not work with StackBlitz and so right now if I were to include imagetools in the template it would break https://node.new/sveltekitWe might want it to be an option as sharp is much faster and would probably be preferred for most users: https://sharp.pixelplumbing.com/performance
The text was updated successfully, but these errors were encountered: