Nuxt 3.16
There's a lot in this one!
⚡️ A New New Nuxt
Say hello to create-nuxt
, a new tool for starting Nuxt projects (big thanks to @devgar for donating the package name)!
It's a streamlined version of nuxi init
- just a sixth of the size and bundled as a single file with all dependencies inlined, to get you going as fast as possible.
Starting a new project is as simple as:
npm create nuxt
Special thanks to @cmang for the beautiful ASCII-art. ❤️
Want to learn more about where we're headed with the Nuxt CLI? Check out our roadmap here, including our plans for an interactive modules selector.
🚀 Unhead v2
We've upgraded to unhead
v2, the engine behind Nuxt's <head>
management. This major version removes deprecations and improves how context works:
- For Nuxt 3 users, we're shipping a legacy compatibility build so nothing breaks
- The context implementation is now more direct via Nuxt itself
// Nuxt now re-exports composables while properly resolving the context
export function useHead(input, options = {}) {
const unhead = injectHead(options.nuxt)
return head(input, { head: unhead, ...options })
}
If you're using Unhead directly in your app, keep in mind:
- Import from Nuxt's auto-imports or
#app/composables/head
instead of@unhead/vue
- Importing directly from
@unhead/vue
might lose async context
Don't worry though - we've maintained backward compatibility in Nuxt 3, so most users won't need to change anything!
If you've opted into compatibilityVersion: 4
, check out our upgrade guide for additional changes.
🔧 Devtools v2 Upgrade
Nuxt Devtools has leveled up to v2 (#30889)!
You'll love the new features like custom editor selection, Discovery.js for inspecting resolved configs (perfect for debugging), the return of the schema generator, and slimmer dependencies.
One of our favorite improvements is the ability to track how modules modify your Nuxt configuration - giving you X-ray vision into what's happening under the hood.
👉 Discover all the details in the Nuxt DevTools release notes.
⚡️ Performance Improvements
We're continuing to make Nuxt faster, and there are a number of improvements in v3.16:
- Using
exsolve
for module resolution (#31124) along with the rest of the unjs ecosystem (nitro, c12, pkg-types, and more) - which dramatically speeds up module resolution - Smarter module resolution paths (#31037) - prioritizes direct imports for better efficiency
- Eliminated duplicated Nitro alias resolution (#31088) - leaner file handling
- Streamlined
loadNuxt
by skipping unnecessary resolution steps (#31176) - faster startups - Adopt
oxc-parser
for parsing in Nuxt plugins (#30066)
All these speed boosts happen automatically - no configuration needed!
Shout out to CodSpeed with Vitest benchmarking to measure these improvements in CI - it has been really helpful.
To add some anecdotal evidence, my personal site at roe.dev loads 32% faster with v3.16, and nuxt.com is 28% faster. I hope you see similar results! ⚡️
🕰️ Delayed Hydration Support
We're very pleased to bring you native delayed/lazy hydration support (#26468)! This lets you control exactly when components hydrate, which can improve initial load performance and time-to-interactive. We're leveraging Vue's built-in hydration strategies - check them out in the Vue docs.
<template>
<!-- Hydrate when component becomes visible in viewport -->
<LazyExpensiveComponent hydrate-on-visible />
<!-- Hydrate when browser is idle -->
<LazyHeavyComponent hydrate-on-idle />
<!-- Hydrate on interaction (mouseover in this case) -->
<LazyDropdown hydrate-on-interaction="mouseover" />
<!-- Hydrate when media query matches -->
<LazyMobileMenu hydrate-on-media-query="(max-width: 768px)" />
<!-- Hydrate after a specific delay in milliseconds -->
<LazyFooter :hydrate-after="2000" />
</template>
You can also listen for when hydration happens with the @hydrated
event:
<LazyComponent hydrate-on-visible @hydrated="onComponentHydrated" />
Learn more about lazy hydration in our components documentation.
🧩 Advanced Pages Configuration
You can now fine-tune which files Nuxt scans for pages (#31090), giving you more control over your project structure:
export default defineNuxtConfig({
pages: {
// Filter specific files or directories
pattern: ['**/*.vue'],
}
})
🔍 Enhanced Debugging
We've made debugging with the debug
option more flexible! Now you can enable just the debug logs you need (#30578):
export default defineNuxtConfig({
debug: {
// Enable specific debugging features
templates: true,
modules: true,
watchers: true,
hooks: {
client: true,
server: true,
},
nitro: true,
router: true,
hydration: true,
}
})
Or keep it simple with debug: true
to enable all these debugging features.
🎨 Decorators Support
For the decorator fans out there (whoever you are!), we've added experimental support (#27672). As with all experimental features, feedback is much appreciated.
export default defineNuxtConfig({
experimental: {
decorators: true
}
})
function something (_method: () => unknown) {
return () => 'decorated'
}
class SomeClass {
@something
public someMethod () {
return 'initial'
}
}
const value = new SomeClass().someMethod()
// returns 'decorated'
📛 Named Layer Aliases
It's been much requested, and it's here! Auto-scanned local layers (from your ~~/layers
directory) now automatically create aliases. You can access your ~~/layers/test
layer via #layers/test
(#30948) - no configuration needed.
If you want named aliases for other layers, you can add a name to your layer configuration:
export default defineNuxtConfig({
$meta: {
name: 'example-layer',
},
})
This creates the alias #layers/example-layer
pointing to your layer - making imports cleaner and more intuitive.
🧪 Error Handling Improvements
We've greatly improved error messages and source tracking (#31144):
- Better warnings for undefined
useAsyncData
calls with precise file location information - Error pages now appear correctly on island page errors (#31081)
Plus, we're now using Nitro's beautiful error handling (powered by youch) to provide more helpful error messages in the terminal, complete with stacktrace support.
Nitro now also automatically applies source maps without requiring extra Node options, and we set appropriate security headers when rendering error pages.
📦 Module Development Improvements
For module authors, we've added the ability to augment Nitro types with addTypeTemplate
(#31079):
// Inside your Nuxt module
export default defineNuxtModule({
setup(options, nuxt) {
addTypeTemplate({
filename: 'types/my-module.d.ts',
getContents: () => `
declare module 'nitropack' {
interface NitroRouteConfig {
myCustomOption?: boolean
}
}
`
}, { nitro: true })
}
})
⚙️ Nitro v2.11 Upgrade
We've upgraded to Nitro v2.11. There are so many improvements - more than I can cover in these brief release notes.
👉 Check out all the details in the Nitro v2.11.0 release notes.
📦 New unjs
Major Versions
This release includes several major version upgrades from the unjs ecosystem, focused on performance and smaller bundle sizes through ESM-only distributions:
- unenv upgraded to v2 (full rewrite)
- db0 upgraded to v0.3 (ESM-only, native node:sql, improvements)
- ohash upgraded to v2 (ESM-only, native node:crypto support, much faster)
- untyped upgraded to v2 (ESM-only, smaller install size)
- unimport upgraded to v4 (improvements)
- c12 upgraded to v3 (ESM-only)
- pathe upgraded to v2 (ESM-only)
- cookie-es upgraded to v2 (ESM-only)
- esbuild upgraded to v0.25
- chokidar upgraded to v4
✅ Upgrading
As usual, our recommendation for upgrading is to run:
npx nuxi@latest upgrade --dedupe
This refreshes your lockfile and pulls in all the latest dependencies that Nuxt relies on, especially from the unjs ecosystem.
Full release notes
A huge thank you to everyone who's been a part of this release. ❤️
I'm aware there have been lots of very significant changes in this release - please don't hesitate to let us know if you have any feedback or issues! 🙏