3.21.0 is the next minor release.
Nuxt 4.3 and 3.21 bring powerful new features for layouts, caching, and developer experience – plus significant performance improvements under the hood.
📣 Some News
Extended v3 Support
Early this month, I opened a discussion to find out how the upgrade had gone from v3 to v4. I was really pleased to hear how well it had gone for most people.
Having said that, we're committed to making sure no one gets left behind. And so we will continue to provide security updates and critical bug fix releases beyond the previously announced end-of-life date of January 31, 2026, meaning Nuxt v3 will meet its end-of-life on July 31, 2026.
Tip
As usual, today also brings a minor release for v3, with many of the same improvements backported from v4.3.
Preparing for Nuxt 5
We're closer than ever to the releases of Nuxt v5 and Nitro v3. In the coming weeks, the main branch of the Nuxt repository will begin receiving initial commits for Nuxt 5. However, it's still business as usual.
- Continue making pull requests to the
mainbranch - We'll backport changes to the
4.xand3.xbranches
Keep an eye out on the Upgrade Guide – we'll be adding details about how you can already start migrating your projects to prepare for Nuxt v4 with future.compatibilityVersion: 5.
🗂️ Route Rule Layouts
But that's enough about the future. We have a lot of good things for you today!
First, you can now set layouts directly in route rules using the new appLayout property (#31092). This provides a centralized, declarative way to manage layouts across your application without scattering definePageMeta calls throughout your pages.
export default defineNuxtConfig({
routeRules: {
'/admin/**': { appLayout: 'admin' },
'/dashboard/**': { appLayout: 'dashboard' },
'/auth/**': { appLayout: 'minimal' }
}
})This might be useful for:
- Admin panels with a shared layout across many routes
- Marketing pages that need a different layout from the app
Tip
Plus, you can pass props to layouts now! See the setPageLayout improvements below.
📦 ISR/SWR Payload Extraction
Payload extraction now works with ISR (incremental static regeneration), SWR (stale-while-revalidate) and cache routeRules (#33467). Previously, only pre-rendered pages could generate _payload.json files.
This means:
- Client-side navigation to ISR/SWR pages can use cached payloads
- CDNs (Vercel, Netlify, Cloudflare) can cache payload files alongside HTML
- Fewer API calls during navigation – data can be prefetched and served from the cached payload
export default defineNuxtConfig({
routeRules: {
'/products/**': {
isr: 3600, // Revalidate every hour
}
}
})🧹 Dev Mode Payload Extraction
Related to the above, payload extraction now also works in development mode (#30784). This makes it easier to test and debug payload behavior without needing to run a production build.
Important
Payload extraction works in dev mode with nitro.static set to true, or for individual pages which have isr, swr, prerender or cache route rules.
🚫 Disable Modules from Layers
When extending Nuxt layers, you can now disable specific modules that you don't need (#33883). Just pass false to the module's options:
export default defineNuxtConfig({
extends: ['../shared-layer'],
// disable @nuxt/image from layer
image: false,
})🏷️ Route Groups in Page Meta
Route groups (folders wrapped in parentheses like (protected)/) are now exposed in page meta (#33460). This makes it easy to check which groups a route belongs to in middleware or anywhere you have access to the route.
<script setup lang="ts">
// This page's meta will include: { groups: ['protected'] }
useRoute().meta.groups
</script>export default defineNuxtRouteMiddleware((to) => {
if (to.meta.groups?.includes('protected') && !isAuthenticated()) {
return navigateTo('/login')
}
})This provides a clean, convention-based approach to route-level authorization without needing to add definePageMeta to every protected page.
🎨 Layout Props with setPageLayout
The setPageLayout composable now accepts a second parameter to pass props to your layout (#33805):
export default defineNuxtRouteMiddleware((to) => {
setPageLayout('admin', {
sidebar: true,
theme: 'dark'
})
})<script setup lang="ts">
defineProps<{
sidebar?: boolean
theme?: 'light' | 'dark'
}>()
</script>🔧 #server Alias
A new #server alias provides clean imports within your server directory (#33870), similar to how #shared works:
// Before: relative path hell
import { helper } from '../../../../utils/helper'
// After: clean and predictable
import { helper } from '#server/utils/helper'The alias includes import protection – you can't accidentally import #server code from client or shared contexts.
🪟 Draggable Error Overlay
The development error overlay introduced in Nuxt 4.2 is now draggable and can be minimized (#33695). You can:
- Drag it to any corner of the screen (it snaps to edges)
- Minimize it to a small pill button when you want to keep working
- Your position and minimized state persist across page reloads
This is a quality-of-life improvement when you're iterating on fixes and don't want the overlay blocking your view.
https://github.com/user-attachments/assets/nuxt_4-3_error_demo.mp4
⚙️ Async Plugin Constructors
Module authors can now use async functions when adding build plugins (#33619):
export default defineNuxtModule({
async setup() {
// Lazy load only when actually needed
addVitePlugin(() => import('my-cool-plugin').then(r => r.default()))
// No need to load webpack plugin if using Vite
addWebpackPlugin(() => import('my-cool-plugin/webpack').then(r => r.default()))
}
})This enables true lazy loading of build plugins, avoiding unnecessary code loading when plugins aren't needed.
🚀 Performance Improvements
This release includes several performance optimizations for faster builds:
- Hook filters - Internal plugins now use filters to avoid running hooks unnecessarily (#33898)
- SSR styles optimization - The
nuxt:ssr-stylesplugin is now significantly faster (#33862, #33865) - Layer alias transform - Skipped when using Vite (it handles this natively) (#33864)
- Route rules compilation - Route rules are now compiled into a client chunk using
rou3, removing the need forradix3in the client bundle and eliminating app manifest fetches (#33920)
🎨 Inline Styles for Webpack/Rspack
The inlineStyles feature now works with webpack and rspack builders (#33966), not just Vite. This enables critical CSS inlining for better Core Web Vitals regardless of your bundler choice.
⚠️ Deprecations
statusCode → status, statusMessage → statusText
In preparation for Nitro v3 and H3 v2, we're moving to use Web API naming conventions (#33912). The old properties still work but are deprecated in advance of v5:
- throw createError({ statusCode: 404, statusMessage: 'Not Found' })
+ throw createError({ status: 404, statusText: 'Not Found' })🐛 Bug Fixes
Notable fixes in this release:
- Fixed head component deduplication using
keyattribute (#33958, #33963) - Fixed async data properties not being reactive in Options API (#34119)
- Fixed
useCookieunsafe number parsing during decode (#34007) - Fixed
NuxtPagenot re-rendering when nestedNuxtLayouthas layouts disabled (#34078) - Fixed client-side pathname decoding for non-ASCII route aliases (#34043)
- Fixed suspense remounting when navigating after pending state (#33991)
- Fixed clipboard copy in error overlay (#33873)
- Enabled
allowArbitraryExtensionsby default in TypeScript config (#34084) - Added
noUncheckedIndexedAccessto server tsconfig for safer typing (#33985)
Important
Enabling noUncheckedIndexedAccess in the Nitro server TypeScript config improves type safety but may surface new type errors in your server code. This change was necessary because Nuxt's app context performs type checks on server routes (learn more).
While we recommend keeping this enabled for better type safety, you can disable it if needed:
export default defineNuxtConfig({
nitro: {
typescript: {
tsConfig: {
compilerOptions: {
noUncheckedIndexedAccess: false
}
}
}
}
})Note that disabling this may allow type errors to slip through that could cause runtime issues with indexed access.
📚 Documentation
- Improved module author guides with clearer structure (#33803)
- Added MCP setup instructions for Claude Desktop (#33914)
- Added layers directory documentation (#33967)
- Added Deno package manager examples (#34070)
- Clarified type-checking context limitations for server routes (#33964)
🎉 Nuxt 3.21.0
Alongside v4.3.0, we're releasing Nuxt v3.21.0 with many of the same improvements backported to the 3.x branch. This release includes:
- All the same features: Route rule layouts, ISR payload extraction, layout props with
setPageLayout,#serveralias, draggable error overlay, and more - All performance improvements: SSR styles optimization, hook filters, and route rules compilation
- Module disabling: Disable layer modules by setting options to
false - Critical bug fixes: Async data reactivity in Options API,
useCookienumber parsing, head component deduplication, and more
✅ Upgrading
Our recommendation for upgrading is to run:
npx nuxt@latest upgrade --dedupe --channel=v3This will deduplicate your lockfile and help ensure you pull in updates from other dependencies that Nuxt relies on, particularly in the unjs ecosystem.
Tip
Check out our upgrade guide if upgrading from an older version.
👉 Changelog
🚀 Enhancements
- kit: Support async constructor for adding plugins (#33619)
- kit: Export Nuxt major version type (#33700)
- schema: Add
#serveralias for server directory imports (#33870) - schema: Hoist nitro
crosswstypes (6ff79ea6c) - nitro,nuxt: Compile route rules into client chunk (#33920)
- nuxt: Allow disabling modules by setting module options to
false(#33883) - kit: Allow specifying
moduleDependenciesas an async function (#33504) - nuxt: Support
appLayoutin route rules (#31092) - nuxt: Add route groups to page meta (#33460)
- nuxt: Enable payload extraction for ISR/SWR routes (#33467)
- nuxt: Allow updating props with
setPageLayout(#33805) - nuxt: Enable dragging and minimizing for error overlay (#33695)
- nitro,nuxt: Add support for payload extraction in dev (#30784)
- rspack,webpack: Add inline styles (#33966)
- kit: Add forward-compatible nitro types (#34036)
🔥 Performance
- nuxt: Do not init layer alias transform when using vite (#33864)
- vite: Add hook filters for ssr styles plugin (#33865)
- vite: Optimize
nuxt:ssr-stylesplugin (#33862) - nuxt: Use filter for vfs plugin load (5bd8e81ed)
- nuxt,vite: Use filters to avoid running hooks unnecessarily (e762a1e20)
- nuxt,vite: Add more filters to internal plugins (#33898)
🩹 Fixes
- kit: Normalize local layer paths with trailing slashes (#33858)
- nuxt: Avoid overwriting multiple head input in island handler (#33849)
- nuxt: Update meta instead of calling
router.replacein page hmr (#33897) - nuxt: Don't call
page:loading:endin cache if already called (fbbe10133) - vite: Add error handling for parsing
NUXT_VITE_NODE_OPTIONS(8abb7ef5b) - nuxt: Do not skip middleware when
appMiddlewarereferences invalid key (ed8bb68c5) - nitro: Clipboard copy in error overlay (#33873)
- webpack,rspack: Resolve deep imports in virtual files (#33927)
- webpack: Disable async chunks in dev mode (c4bfd0a49)
- webpack: Correctly evaluate sourcemap name (93e3d92b9)
- nuxt: Handle node10 resolution for
nuxt/meta(b748840bc) - nuxt: Do not early return if component priorities conflict (#33955)
- nuxt: Use
keyfor tag deduplication in<Head>component (#33958) - schema,vite: Resolve
build.transpilewhen initialising vite (#33868) - nuxt,rspack,webpack: Inject module identifiers for webpack builders (#33962)
- nuxt: Add key to head components for proper deduplication (#33963)
- nitro: Check prettyResponse.body type before error overlay (#33977)
- nuxt: Don't URI-encode static route paths (#33990)
- nuxt: Skip internal stub routes from prerender (#34001)
- kit,schema: Align module
onUpgradearguments with types (#33988) - nuxt: Handle unsafe number parsing in useCookie decode (#34007)
- nuxt: Do not externalise
rou3(7da94e8c3) - nitro: Add
noUncheckedIndexedAccessto server tsconfig (#33985) - nuxt: Update global reference to globalThis in
useRequestFetch(#33976) - vite: Configure hmr port for server build (#33929)
- kit: Add forward compatible nitro v3 types (#34053)
- nitro,nuxt: Do not import nitro deps in builders (#34054)
- nitro: Add
h3types to auto-imports (#34035) - schema: Add some more directories to ignore (9cb9a19dd)
- nitro: Also augment
nuxt/schema(9b40196a6) - nuxt: Make asyncData properties reactive in Options API (#34119)
- nuxt: Rerender
NuxtPagewhen nestedNuxtLayouthas explicitly disabled layouts (#34078) - nuxt,schema: Clean up types (5ce351d0f)
- nuxt: Allow user augmentation of runtime config (dd30410cb)
- kit,nitro: Enable
allowArbitraryExtensionsby default (#34084) - nuxt: Decode client-side pathname for non-ASCII route aliases (#34043)
- nuxt: Force remount suspense when navigating after pending (#33991)
- nuxt: Add documentation link to server builder error message (#34122)
- nuxt: Validate placeholder/fallback tags + warn about placeholder/fallback props (f7912d3f3)
- nuxt: Force flush
useAsyncDatadebounced execute post watcher flush (#34125) - nitro: Process isr/swr/cache keys (7f2bf4d13)
- nuxt: Add
typeFromsupport forimports.d.tstemplate exports (#34135) - nuxt: Ensure we inline styles for
hydrate-nevercomponents (#34132)
💅 Refactors
- kit: Add explicit return types for kit utilities (ec2239cb4)
- nitro,nuxt,schema,vite: Provide explicit return types (2564002de)
- kit,nuxt,schema: Use named imports from
defu+consola(e31668f67) - Add explicit
.tsfile extensions to relative imports (458f3c9b6) - kit,nitro,nuxt,schema: Reduce barrels + move
<>toas(08f72881e) - nitro,nuxt: Use
~prefix for internal ssrContext properties (#33896) - nitro: Add explicit return types for runtime utils (74bb6ddeb)
- nitro: Move tree-shaken flags from replace plugin -> vfs (#33907)
- nitro,nuxt,vite,webpack: Use
status/statusText+ deprecate old props (#33912) - webpack: Use RuntimeModule API for chunk preloads (#33930)
- nuxt: Use AST-aware function key injection (#33446)
- nitro,nuxt,schema: Use augments for nitro schema types (#34039)
- nitro,rspack,vite,webpack: Move cors handling -> nitro builder (#34048)
- nitro: Move to
nitropack/runtimenamespace (b06d53166) - nitro,nuxt: Move to
nitropack/runtimenamespace (897a2259f)
📖 Documentation
- Fix
useHeadreturn type (#33857) - Add correct instructions to upgrade to latest Nuxt 3.x (#33866)
- Improve grammar (#34093)
- Use h2 for nuxt add command page (a0a1763d5)
- Update links to module guide (c9c1282f8)
- Split and improve
Module Author Guides(#33803) - Split directory structure and re-order guides (v4) (#33691)
- Add mcp server and llms.txt (#33371)
- Add note that middleware doesn't run when rendering islands (d22cf7903)
- Add note on default branch for layers (#33919)
- Add mcp setup instructions for claude desktop (#33914)
- Mention deno as package manager (#33875)
- Clarify purpose of
statusText(#32834) - Update lychee config and remove medium article link (36c19ce73)
- Update module count and fix typo (#33950)
- Add DeepWiki badge (#33508)
- Give example of usage of
defineWrappedResponseHandler(#33952) - Provide cleaner example code for vitest projects (#33960)
- Update yarn create command (b30432979)
- Update roadmap with a11y (7ea35137c)
- Add a11y release (#34041)
- Remove Nuxtr from recommendations (#34045)
- Remove duplicate feature (#34058)
- Provide deno package manager examples (#34070)
- Make custom wrapper recipe link more prominent (#34085)
- nuxt: Mention custom serializers in
useStatedocs (#34105) - Clarify module setups in
.nuxtrcexample (#34107) - Add layers directory documentation (#33967)
- Add a tip for
appLayout(9b78698c3) - Add docs for disabling modules by passing
falseto its options (18500730c) - Add info about caching payloads with isr/swr (4b055548e)
- Add example for async addVitePlugin (4407f6862)
- Add example of passing props to layouts (401aa90ab)
- Mark vite plugin as not typed (25eae7699)
- Add warning about
sourcefrom<NuxtIsland>(08778c98c) - Sync with main branch (e8c04aaa6)
- Fix ai guide link (01c173b78)
📦 Build
- Remove babel debugging plugin from jiti stub options (1ec010681)
- vite: Add build entries for
vite-nodeentrypoints (#33893) - nuxt: Tidy up subpath export types (fe92e9c17)
- Use
obuildexcept for nuxt + nitro-server packages (#34049) - schema: Fix
/builder-envsubpath types (1951648fa)
🏡 Chore
- Add return types to debug plugins (1d4f9a3ae)
- Add
build:stubcommand for those that need it (c682b2681) - Revert change to how type augments are inserted (6a238b576)
- Do not require aligned columns in tables (d8a90b3d5)
- Update eslint config rule (d87ed519a)
- Explicitly import
node:process(#33982) - Add root scripts to lint context (ee83838b4)
- Tidy up configs (ab131b464)
- Add
.nuxtrcwith test-utils setup (b5879351f) - Add eslint ignore (87811234d)
- Upgrade
vite-nodeseparately fromvitest(8114e886f) - Lint docs with eslint (d2d5f6733)
- Lint (b9df0e847)
- Lint (0efcf01fa)
✅ Tests
- Update tests for new version of nuxt/test-utils (#33842)
- Avoid unnecessary tick (fb4720840)
- Add regression test for asyncData HMR (#32182)
- Add test for page hmr resetting state (#32418)
- Add reproduction for vite pre-transform error (#31574)
- Add regression test for #32154 (#32154)
- Use
vi.hoistedfor klona mock (#34113) - Update bundle size (e6c8d10c6)
- Fix paths in hmr test (3b8b2138a)
- Update snapshots (51c83b8ec)
- Update bundle size (22708c05c)
🤖 CI
- Directly call webhook url (4eedbcae5)
- Use new reusable triage workflows (#34072)
- Use new shared dependency review workflow (9e6770f18)
❤️ Contributors
- Daniel Roe (@danielroe)
- Florian Heuberger (@Flo0806)
- Octavio Araiza (@8ctavio)
- Robin (@OrbisK)
- shaheer-arbisoft (@shaheer-arbisoft)
- Francesco Mussoni (@solidusite)
- Danila Poyarkov (@dannote)
- Teages (@Teages)
- Anthony Fu (@antfu)
- Eli Sterken (@eli-sterk)
- Ryota Watanabe (@wattanx)
- edison (@edison1105)
- Max (@onmax)
- Rahul Dogra (@rahuld109)
- abeer0 (@iiio2)
- Philipp Wagner (@imphil)
- Maxime Pauvert (@maximepvrt)
- Wind (@productdevbook)
- Agatem (@agatemosu)
- Pavel (@eL1fe)
- Lucie (@lihbr)
- Sergiu Ravliuc (@YoSoySergio)
- Julien Huang (@huang-julien)
- Saeid Zareie (@Saeid-Za)
- Alireza Jahandideh (@Youhan)
- kikuchan (@kikuchan)
- Ragura (@Ragura)
- Josh Deltener (@hecktarzuli)
- Teena (@franklin-tina)
- Matej Černý (@cernymatej)
- Frederik Bußmann (@freb97)
- Benjamin Oddou (@BenjaminOddou)
- Mukund Shah (@mukundshah)
- Jessé Correia Lins (@linspw)
- Jannik Sohn (@janniksohn)
- Dawit (@oneminch)
- Ali Sokkar (@NyllRE)
- Horu (@HigherOrderLogic)
- Hugo (@HugoRCD)
- Sébastien Chopin (@atinux)
- David Stack (@davidstackio)
- Ruslan Stelmachenko (@xak2000)
- Harlan Wilton (@harlan-zw)
- Alexander Lichter (@TheAlexLichter)
- Ryan Wilson (@rywils)
- yamachi4416 (@yamachi4416)