mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[GH-ISSUE #363] feat(image): build-time image optimization via Sharp #83
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#83
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Divkix on GitHub (Mar 9, 2026).
Original GitHub issue: https://github.com/cloudflare/vinext/issues/363
Summary
Add build-time WebP generation via sharp (optional peer dep) and real-time dev optimization for local images. Closes the gap for local image optimization without requiring paid services.
Current Behavior
Proposed Behavior
Implementation
Sharp is an optional peer dependency. If not installed, everything works exactly as today.
Files Changed
packages/vinext/src/utils/sharp.ts— Sharp availability detectionpackages/vinext/src/shims/image.tsx— Extend StaticImageData, update renderingpackages/vinext/src/index.ts— Build-time?vinext-optplugin + dev server handlerpackages/vinext/src/server/app-dev-server.ts— App Router dev optimizationpackages/vinext/src/server/prod-server.ts— Node.js prod optimizationpackages/vinext/package.json— Optional peer deptests/image-optimization.test.ts— New test filetests/image-component.test.ts— Extended testsEdge Cases Handled
/.vinext-image-cache/)Test Plan
/_vinext/imagereturns WebP with correct Content-Type.webpfiles indist/client/assets/.webpassetspnpm run typecheckandpnpm run lintpass@Divkix commented on GitHub (Mar 10, 2026):
Deferring this work — PR #364 is closed. Will revisit image optimization parity in a future iteration.