Releases: nuxt/image
v2.0.0
We're excited to announce Nuxt Image v2! 🎉 This release focuses on TypeScript support, performance improvements, and better developer experience.
👀 Highlights
Note
Nuxt Image v2 requires Nuxt 3.1+. If you're on Nuxt 3.0.x, you'll need to upgrade to at least 3.1 first.
🎯 TypeScript support
The biggest change in v2 is full TypeScript support throughout the module (#1802).
Typed providers
Image providers now use defineProvider for type-safe configuration:
// Before (v1)
export const getImage = (src, { modifiers, baseURL }) => {
// ...
return { url }
}
// After (v2)
import { defineProvider } from '@nuxt/image/runtime'
export default defineProvider({
getImage(src, { modifiers, baseURL }) {
// Fully typed modifiers
// ...
return { url }
}
})Type-safe configuration
Module options are now fully typed. For example, providers that require a baseURL will enforce it at the type level in your nuxt.config.ts:
export default defineNuxtConfig({
image: {
provider: 'cloudinary',
cloudinary: {
baseURL: 'https://res.cloudinary.com/...' // TypeScript error if missing!
}
}
})Typed composables
The $img helper and useImage() composable have full type inference (#1844):
const img = useImage()
// Full autocomplete for modifiers
const url = img('/image.jpg', {
width: 300,
height: 200,
fit: 'cover' // TypeScript knows the valid values!
})🚀 IPX v3
We've upgraded to IPX v3 (#1799) for better performance and better sharp binary handling. The upgrade includes automatic detection of the correct sharp binaries for your deployment architecture.
🔌 Server-side utilities
You can now use image helpers directly in Nitro server endpoints (#1473).
// server/api/og-image.ts
export default defineEventHandler((event) => {
const img = useImage()
return {
url: img('/hero.jpg', {
width: 1200,
height: 630,
fit: 'cover'
})
}
})🎨 Component improvements
Template refs
<NuxtImg> now exposes the underlying <img> element via template refs:
<template>
<NuxtImg ref="imgEl" src="/image.jpg" />
</template>
<script setup>
const imgEl = ref()
onMounted(() => {
// Direct access to the native img element
console.log(imgEl.value)
})
</script>Typed slots
Both <NuxtImg> and <NuxtPicture> now have properly typed default slots.
🌐 New providers
We've added two new providers:
export default defineNuxtConfig({
image: {
provider: 'shopify',
shopify: {
baseURL: 'https://your-store.myshopify.com'
}
}
})⚡ Performance
We've made several optimizations to reduce bundle size and improve runtime performance:
- Better URL encoding (#1813) - Switched to
URLSearchParamsfor more reliable parameter handling - Reduced runtime utilities (#1816) - Removed unused code and simplified implementations
- Streamlined screen sizes (#1931) - Aligned default breakpoints with Tailwind CSS
🎯 Better layer support
Nuxt Image now properly supports custom image directories within Nuxt layers (#1880), making it easier to organize images in modular projects.
⚠️ Breaking changes
Provider API
The biggest breaking change is how providers are defined. All providers now use a default export with the defineProvider wrapper:
- export const getImage = (src, { modifiers }) => { ... }
+ export default defineProvider({
+ name: 'my-provider',
+ getImage(src, { modifiers }) { ... }
+ })If you maintain a custom provider, you'll need to update it. But you get full TypeScript support in return!
Removed providers
The deprecated layer0 and edgio providers have been removed.
URL formatters
If you have custom providers using joinWith for parameter formatting, you'll need to update them to use the formatter function with createOperationsGenerator. See the migration guide for details.
#### Screen sizes
Default screen sizes now match Tailwind CSS. We've removed `xs` (320px) and `xxl` (2560px). See the [migration guide](https://image.nuxt.com/getting-started/migration#screen-size-changes) for how to add them back if needed.
Removed utilities
We've removed several unused runtime utilities. If you were importing internal utilities directly, check if they still exist.
✅ Upgrading
Check out our comprehensive migration guide for step-by-step upgrade instructions.
The quick version:
npm install @nuxt/image@latestMost apps can upgrade with no code changes. If you have custom providers, you'll need to update them to use defineProvider - see the migration guide for examples.
🐛 Bug fixes
This release includes several fixes:
- Preload links: Fixed preload for multiple densities with single size (#1851)
- Crossorigin attributes: Correct crossorigin on preload links (#1836)
- Provider-specific formats: AWS Amplify and Vercel providers now have proper format allow lists (#1996)
- Hygraph: Prevented broken image URLs (#1999)
- Preset sizes: Fixed preset size application when component sizes prop is undefined (#1919)
- Cloudflare: Don't add baseURL if there are no operations (#1790)
- IPX: Always use IPX provider if external baseURL is provided (#1800)
🙏 Thank you
Thank you to all the contributors who made this release possible! This includes contributions from dozens of community members who helped with features, bug fixes, documentation improvements, and feedback.
👉 Changelog
🚀 Enhancements
- Add support for image helpers in nitro endpoints (#1473)
- deps: Upgrade to ipx v3 (#1799)
- ipx: Log the architecture of the build (#1808)
⚠️ Typed providers + modifiers (#1802)- Add type for default nuxt-picture slots (0e4f174)
- nuxt-img: Add types for default slot (c4bba1b)
- Add shopify provider (#1890)
- Add support for image helpers in nitro endpoints (#1473)
- ipx: Log the architecture of the build (#1808)
- cloudimage: Make baseURL optional with cdn (#1951)
- github: Add provider for github avatars (#1990)
- nuxt-img: Expose
element (#1834)
- Support custom image dirs within layers (#1880)
- Strongly type $Img/useImage methods (#1844)
- Add type hints for provider option (64c76ee)
🔥 Performance
- nuxt-img: Call decode before swapping from placeholder (#2008)
🩹 Fixes
- Remove layer0 and edgio providers (#1763)
- Add back layer0 and edgio providers (without) tests (fee826c)
- cloudflare: Don't add baseURL if there are no operations (#1790)
- ipx: Always use ipx provider if external baseURL is provided (#1800)
- ipxStatic: Strip repeated slashes from image path (#1801)
- edgio,layer0:
⚠️ Remove providers (#1809) ⚠️ Use URLSearchParams as default formatter (#1813)- nuxt-picture: Export DefaultSlotProps (891d79a)
- aliyun: Explicitly import useRuntimeConfig (268eb9c)
- Remove layer0 and edgio providers (#1763)
- Add back layer0 and edgio providers (without) tests (a99ce09)
- cloudflare: Don't add baseURL if there are no operations (#1790)
- ipx: Always use ipx provider if external baseURL is provided (#1800)
- ipxStatic: Strip repeated slashes from image path ([#1801](https://github.com/nuxt/image/pul...
v1.11.0
🚀 Enhancements
- Add support for image helpers in nitro endpoints (#1473)
- ipx: Log the architecture of the build (#1808)
🩹 Fixes
- Remove layer0 and edgio providers (#1763)
- Add back layer0 and edgio providers (without) tests (a99ce09)
- cloudflare: Don't add baseURL if there are no operations (#1790)
- ipx: Always use ipx provider if external baseURL is provided (#1800)
- ipxStatic: Strip repeated slashes from image path (#1801)
- Avoid deep type instantiation (12b37a2)
📖 Documentation
🏡 Chore
- Disable shamefully-hoist (#1795)
- Do not ignore typescript upgrades (0809991)
- Switch to using typesVersions field (b4af05a)
- Allow major bumps in changelog (d486587)
- Enable oxc-resolver build (4be31c7)
- Release v1.11.0 (3123997)
✅ Tests
- Exclude layer0 + edgio from unit tests (3682a90)
🤖 CI
- Run tests against 1.x branch (0c83646)
- Add release workflow and add pkg.pr.new (#1791)
- Set fetch-depth (18ae6c7)
- Test vs node 20 (e6babef)
❤️ Contributors
- Daniel Roe (@danielroe)
- Matis (@matisbag)
- Amir Afshar (@Afshar07)
- Sébastien Chopin (@atinux)
- Nicolas Großmann (@grossmann94)
v2.0.0-alpha.1
This is an alpha version of Nuxt Image v2
👀 Highlights
We'd love your feedback! This release contains quite a lot of changes, including (of course) breaking changes. It also brings a great deal of type safety, though we need to (and plan to!) improve the modifier types for each provider before release.
👉 Changelog
🚀 Enhancements
- Add support for image helpers in nitro endpoints (#1473)
- deps: Upgrade to ipx v3 (#1799)
- ipx: Log the architecture of the build (#1808)
⚠️ Typed providers + modifiers (#1802)- Add type for default nuxt-picture slots (0e4f174)
- nuxt-img: Add types for default slot (c4bba1b)
🩹 Fixes
- Remove layer0 and edgio providers (#1763)
- Add back layer0 and edgio providers (without) tests (fee826c)
- cloudflare: Don't add baseURL if there are no operations (#1790)
- ipx: Always use ipx provider if external baseURL is provided (#1800)
- ipxStatic: Strip repeated slashes from image path (#1801)
- edgio,layer0:
⚠️ Remove providers (#1809) ⚠️ Use URLSearchParams as default formatter (#1813)- nuxt-picture: Export DefaultSlotProps (891d79a)
💅 Refactors
⚠️ Remove unused runtime utilities and simplify code (#1816)
📖 Documentation
🏡 Chore
- Disable shamefully-hoist (#1795)
- Do not ignore typescript upgrades (9421fa5)
- Switch to using typesVersions field (aa39ef4)
- Allow major bumps in changelog (3989629)
✅ Tests
- Exclude layer0 + edgio from unit tests (ffe2177)
- Add size snapshot (#1815)
- Bump timeout (6fe8401)
- Skip bundle size tests in ecosystem ci (301c504)
🤖 CI
⚠️ Breaking Changes
⚠️ Typed providers + modifiers (#1802)- edgio,layer0:
⚠️ Remove providers (#1809) ⚠️ Use URLSearchParams as default formatter (#1813)⚠️ Remove unused runtime utilities and simplify code (#1816)
❤️ Contributors
- Daniel Roe (@danielroe)
- Matis (@matisbag)
- Amir Afshar (@Afshar07)
- Sébastien Chopin (@atinux)
- Nicolas Großmann (@grossmann94)
v1.10.0
🚀 Enhancements
🩹 Fixes
- NuxtImg: Do not access
propsin template (e2e61fa) - NuxtPicture: Make
img-attrsandattrsresponsive (#1696)
📖 Documentation
🏡 Chore
- Skip missing commit in generating changelog (a658787)
- Remove unneeded
.nuxtrcconfig (#1708) - Temporarily ignore typescript upgrade (473f8f1)
- Bump
@nuxtjs/tailwindcss(25379fb) - Bump
@nuxtjs/tailwindcssversion (36fb95e)
🤖 CI
- Force latest corepack (090c31b)
❤️ Contributors
- Daniel Roe (@danielroe)
- Nicolas Payot (@nicolaspayot)
- AdityaKantipudi1 (@AdityaKantipudi1)
- Damian Głowala (@DamianGlowala)
- codeflorist (@codeflorist)
v1.9.0
1.9.0 is the next minor release.
👉 Changelog
🚀 Enhancements
- nuxt-img: Add
customslot for full control of rendering (#1626) - amplify: Add additional modifiers (#1656)
- strapi5: Add new provider with formats (#1621)
🔥 Performance
- Remove
node-fetch-nativedependency (d667025) - Use direct imports from
#app/nuxtand#imports(70ef740)
🩹 Fixes
- prismic: Use unsplash image proxy where necessary (#1614)
- Set up non-default
ipxproviders ifoptions.ipxis set (#1618) - Emit error events from
<NuxtImg>placeholder (#1640) - Add
strapi5to list of built-in providers (1079a03)
📖 Documentation
- Update link to downloads count badge (392991b)
- Improve cloudflare provider page (#1601)
- Make clearer that
xxlis not a tailwind size (#1632) - Add note about the
altprop (#1628) - Capitalize title (#1649)
- Update strapi links (#1650)
🏡 Chore
- Update version link (fa18501)
- docs: Remove unneeded icons config (150db3e)
- Add
knipandinstalled-check+ clean up workspace deps (736102b) - Dedupe lockfile (ddc355b)
✅ Tests
🤖 CI
- Run test suite on windows (#1542)
❤️ Contributors
- Daniel Roe (@danielroe)
- Thilo Hettmer (@ThiloHettmer)
- Bjorn Beishline (@BjornTheProgrammer)
- Daniel Slama (@danekslama)
- Guspan Tanadi (@guspan-tanadi)
- beer (@iiio2)
- Jakub Andrzejewski (@Baroshem)
- Aleksey Razbakov (@razbakov)
- Jianxing Xu (@jianxing-xu)
- David Reese (@whatcould)
- Lucie (@lihbr)
- Yusuf Mansur Özer (@ymansurozer)
v1.8.1
🩹 Fixes
- Suffix export of runtime utils with
/index(#1467) - vercel: Added missing
formatsconfig & improved documentation (#1514)
📖 Documentation
- Update link to downloads count badge (102d474)
🏡 Chore
- Use
tinyexecinternally (3b9a4ea)
❤️ Contributors
- Sébastien Chopin (@atinux)
- Arnaud Gissinger (@mathix420)
- Daniel Roe (@danielroe)
- Damian Głowala (@DamianGlowala)
v1.8.0
👉 Changelog
🚀 Enhancements
- cloudinary: Support reading project from absolute url (#1361)
- Provide runtimeConfig to
getImage(#1428) - hygraph: New asset management support (#1415)
🩹 Fixes
- Prevent hydration mismatch in
<NuxtImg>(#1445) - nuxt-picture: Check before accessing index (917242a)
- Mark props as not required rather than
default: undefined(#1450) - Handle undefined indices more accurately (#1451)
- hygraph: Add back tests and refactor splitter (#1452)
❤️ Contributors
- Connor Pearson (@cjpearson)
- Mark Brouch (@markbrouch)
- Daniel Roe (@danielroe)
- Damian Głowala (@DamianGlowala)
- Tim Benniks (@timbenniks)
v1.7.1
🩹 Fixes
- cloudinary: Map
covertolfillmode (#1355) - Import runtime types from module entrypoint (#1384)
- Update to latest
@nuxt/module-builder(#1439) - Only add preload links on server (510e719)
- weserv: Map rotate operation to
ro(#1441)
💅 Refactors
- Convert
<NuxtImg>to SFC (#1435) - Convert
<NuxtPicture>to SFC (#1432) - Use more
import.meta.*properties (#1440)
📖 Documentation
- Update deps (86b7d9b)
- Add resolution for nuxt ui (3a98a68)
- Prerender index (59813cf)
- Prepare before build (#1405)
- Fix inconsistent spelling (#1421)
- Capitalize title (#1393)
🏡 Chore
- Refresh lockfile (5524ae6)
- Add subpath exports and set
type: module(04cd4cc) - Remove unneeded lazy from regexp (16b20b4)
- Indicate compatibility with new v4 major (#1385)
- Add @danielroe to code owners (47f8b2c)
- Add
compatibilityDate(8e2a01a)
❤️ Contributors
- Daniel Roe (@danielroe)
- Damian Głowala (@DamianGlowala)
- @beer (@iiio2)
- Gangan (@shinGangan)
- Benjamin Canac (@benjamincanac)
- Sébastien Chopin (@atinux)
- @ptdev
v1.7.0
🚀 Enhancements
- Allow specifying
fetchprioritywhen preloading images (#989)
🩹 Fixes
- Ensure
srccomes afterloadingwhen rendering image (#1338)
📖 Documentation
- Fix typo in get-started/installation (#1344)
🤖 CI
- Add codecov token (#1342)
❤️ Contributors
- Jonas Thelemann (@dargmuesli)
- Tom Tang (@qwerzl)
- Daniel Roe (@danielroe)
- Ragura (@Ragura)
v1.6.0
👉 Changelog
🚀 Enhancements
🩹 Fixes
- hygraph: Support new hygraph asset system (#1321)
- uploadcare: Omit base when resolved URL is returned (#1254)
- Handle
undefinedor empty image source values (#1300) - Reduce warnings about
densityvalues > 2 (dad493a) - netlify: Normalise
jpegformat tojpg(a59e57c)
📖 Documentation
- Use new
nuxi module addcommand in installation (#1310) - Warn
<NuxtPicture>doesn't support different sources (#1326)
🏡 Chore
- Migrate to eslint v9 (#1333)
- Slight reformatting (3baadb5)
- Lint test files (e8db947)
- Bump
devDependencies(74605cb)
✅ Tests
- Improve test stability (42646f4)
❤️ Contributors
- Daniel Roe (@danielroe)
- Thimo (@ThimoDEV)
- Nathan Chase (@nathanchase)
- aaron lejeune (@aaronLejeune)
- Lehoczky Zoltán (@Lehoczky)
- Scott Kennedy (@scottyzen)
- Tim Benniks (@timbenniks)