-
Notifications
You must be signed in to change notification settings - Fork 287
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
NuxtImage + IPX + SWR = return buffer #1400
Comments
do you have reproduction? I can't seem to replicate the issue |
Sure: git clone https://github.com/bernhardberger/nuxt-ipx-swr-buffer-minimal-reproduction
cd nuxt-ipx-swr-buffer-minimal-reproduction
npm run build && node .output/server/index.mjs -> hard reload (CTRL+SHIFT+R) a few times after 10 seconds -> image will be dead |
related: nuxt/nuxt#27307 |
Imho this should be documented.. |
We have now solved this using a nitro onBeforeResponse hook that unwraps and streams the Buffer so we can still use swr caching on /_ipx/** generated images (so the image gets served from a cache and the user won't have to wait for the regenerated image every time) We'll provide a code sample later when it's tested. |
Hey @bernhardberger, did you already done working with nitro hook code sample? Thanks in advance. EDIT: Just made simple nuxt module to cache optimized images from ipx request to disk, inspired by #795. (You'll need to download and run the example project since stackblitz seems not working with native |
+1 |
You are my hero! You should consider making this a published module, it will save a lot of people's life! |
Closing as the solution was provided. Feel free to reopen if needed :) |
I still think this should have first class support + the issue with returning a buffer should be resolved. |
When I enable SWR on our website IPX/nitro/whatever the culprit.. returns a buffer instead of an image:
Any ideas how to work around this? This has been a major issue for us, preventing is to run SWR on our website and customer projects..
The text was updated successfully, but these errors were encountered: