-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Adapter Vercel Image Optimizations #8561
Comments
I'm not sure just adding the options is enough, there's also work involved to create a specific image component I guess? Related to #241 |
you can leave that to the community, because thats more subjective and that would be separate from an adapter package anyway, but without the ability to put these options in the build config then you can't use it, so this shouldn't be the breakpoint of using features |
Also all the solutions I have seen are for local images, not remote images. |
Next and Nuxt have supported image components, but from my understanding once enabled you could also just update your image srcs manually from eg /public/images/logo.png to /_vercel/image?url=/public/image/logo.png?w=320&q=80. A fancy image component could come later if the community wants it, but just enabling this would be a great enhancement IMO |
Exactly |
@lettucebowler has made a PR for this #8667. |
Example usage as of today shared on Discord by OP:
|
@hartwm @benmccann do you have working example hoisted anywhere (e.g. GitHub, Code sandbox etc. ). I wanted to see the configuration details. Thanks. |
https://github.com/hartwm/vercel-images-sveltekit |
There are a couple PRs out for this:
|
Hi @hartwm, thanks so much for providing these examples! I do have one question I wonder if anyone knows the answer to. Vite lets you import images like this:
That means that a hash gets put in their name so that they can be cached forever. Is it possible to use such an image with the Vercel image solution? When I go to https://vercel-images-sveltekit.vercel.app/ I notice that the local image can't be cached as strongly as the Vite processed images we have today. If you hit the page a second time, it returns a 304 response as opposed to avoiding the request entirely. I wonder if it's possible to use an imported image so that Vite processes the request before Vercel takes over possibly allowing us to skip the request entirely still. If it's possible, it'd be a great example to add to https://github.com/hartwm/vercel-images-sveltekit |
@benmccann You can set It looks like you merged #8667 (review) which relates to the OP... Considering the ability to set |
@benmccann Regarding "Vite processes the request before Vercel takes over"... It kind of defeats the purpose of using Vercel to send the correct image type ( I do believe Next.js implements their own code that emulates what the Vercel image optimization endpoint does, so it may be possible to add such functionality to SvelteKit itself, but you probably will have a very similar approach. |
Describe the problem
Would be really awesome if
adapter-vercel
package acceptedimages
option for using Vercel's native image optimization. It only requires simple addition of images object to build config file.vercel/output/config.json
. I would submit a pull request but I am sure the options, naming conventions, etc would not be as the team would desire. Given it is such a straightforward task it probably wouldn't prove helpful.Describe the proposed solution
Here are the options
https://vercel.com/docs/concepts/image-optimization
https://vercel.com/docs/build-output-api/v3#build-output-configuration/supported-properties/images
Alternatives considered
No response
Importance
nice to have
Additional Information
No response
The text was updated successfully, but these errors were encountered: