TL;DR: ESM-only, Node 22+ minimum, and huge memory and performance wins over v6.
Thank you to @sentience, @valadaptive, @kirthi-b, @jens-struct, and @jornmineur for their contributions to this release!
Issue Milestone: https://github.com/11ty/eleventy-img/milestone/25?closed=1
Full Changelog: v6.0.4...v7.0.0
Breaking changes
- Node 22 or newer is required. This matches Core v4. #351
- The package is now ESM. This is unlikely to require any changes as the Node minimum now supports
require(esm). #300- ESM:
import Image from "@11ty/eleventy-img" - CommonJS friendly:
const Image = await import("@11ty/eleventy-img")
- ESM:
- Upgrades sharp from v0.33 to v0.35 #352, #289
And a few breaking changes that are unlikely to affect most projects:
- If you use the Transform method and set both
widthandeleventy:widthson the same element, note thateleventy:widthsnow takes priority. #314 Image.statsSyncandImage.statsByDimensionsSynchave been removed after being deprecated in 2024. Use thestatsOnlyfeature instead, like so:await Image(src, { statsOnly: true, /* …options */ }). Helpful error messaging is provided if your project uses these (so don’t worry about it until you run into it, they weren’t commonly used). #211 #295- Removes the
<eleventy-image>WebC component (use the transform method instead) #305
New Features
- New passthrough format (usage:
formats: ["passthrough"]) copies and uses the source file directly, while still adding width and height attributes to the generated output. Useful when you've already optimized your source images and want to skip the optimization pipeline — about 20× faster in local benchmarks. Example on #212. Also #133, #183, #309 - New
eleventy:sizesattribute allows overriding anysizesattribute in markup #306 - New
manualCacheKeyoption to improve the cropping API #271 #274 by @jens-struct
Bug Fixes
- Huge memory usage improvements from @sentience in #313 and @jornmineur in #302 #319 (v6 had issues, but we’ve eclipsed v5 performance with this release 🏆)
- Removes the
wdescriptor when only one size is used in srcset, fixing valid HTML output when only one width is used and no sizes is present (#298). - Fixes
eleventy:ignoreappearing in output on<img>tags inside<picture>elements — by @valadaptive in #303. - Decodes HTML entities on
<img src>when read back from HTML, by @kirthi-b #349 #307
Internals
- Swaps the debug dependency for obug (#356).
- Major version dependency upgrade: upgrades p-queue from v6.6 to v8.1. #120 This dependency became ESM-only in v7 and Node 18+ in v8.