Repository navigation
Alternatives to Sharp for image optimization on Cloudflare Workers? #16937
Replies: 2 comments
|
Hi, Andrew |
|
The thing to internalize first: Payload's image pipeline isn't pluggable. Sharp is optional in the config now, so that part is easy. Just don't pass it: export default buildConfig({
// sharp, <- leave this out on Workers
collections: [Media],
})Without sharp you lose From there you've got two real paths, and they're the ones CarloBu already pointed at:
For most setups the Cloudflare Images route is less code and less to maintain. Reach for jSquash when you specifically want to keep everything on Workers with no extra service. |
Uh oh!
There was an error while loading. Please reload this page.
Hi everyone,
I'm deploying Payload CMS on Cloudflare Workers and looking for recommendations regarding image optimization.
As far as I understand, Payload relies on Sharp for image processing, but Sharp doesn't work in the Cloudflare Workers runtime because native Node.js binaries are not supported.
I'm curious how others are handling image optimization in a Workers-based deployment.
Some questions:
Are there any production-ready alternatives to Sharp that work inside Cloudflare Workers?
Has anyone successfully integrated libraries such as @cf-wasm/photon, squoosh, or other WASM-based solutions with Payload?
Is it better to completely offload image transformations to Cloudflare Images or another external service?
Are there any community examples of running Payload image processing on Workers without Sharp?
My goal is to keep the deployment fully serverless on Cloudflare if possible, while still supporting image resizing, format conversion (WebP/AVIF), and optimization.
I'd appreciate hearing about any approaches, trade-offs, or examples from real-world deployments.
Thanks!
All reactions