v4.0.0
Breaking Changes📦 nuxtView on GitHub →
⚠ 5 breaking✨ 5 features🐛 2 fixes⚡ 1 deprecations🔧 5 symbols
Summary
Nuxt 4 is a stability-focused major release introducing a new 'app/' directory structure, improved TypeScript context separation, and a faster socket-based CLI. It streamlines the data fetching layer while providing a smooth migration path for Nuxt 3 projects.
⚠️ Breaking Changes
- New default project structure: Application code now resides in the 'app/' directory by default. Existing structures are still detected but the default has shifted.
- Data fetching defaults: useAsyncData and useFetch now have different default behaviors regarding data sharing and cleanup.
- TypeScript project separation: Nuxt now creates separate TS projects for app, server, shared, and builder contexts, which may surface new type errors.
- Nuxt 2 compatibility removed from @nuxt/kit, affecting module authors.
- Removal of legacy utilities and deprecated features from previous versions.
Migration Steps
- Read the official Nuxt 4 upgrade guide.
- Run 'npx nuxt upgrade --dedupe' to update dependencies and deduplicate the lockfile.
- Optional: Run 'npx codemod@latest nuxt/4/migration-recipe' to automate code changes.
- Review TypeScript errors surfaced by the new project-based separation.
- Verify module compatibility and update any modules that do not yet support Nuxt 4.
✨ New Features
- New 'app/' directory structure for cleaner project organization.
- Smarter data fetching: Automatic data sharing between components with the same key, automatic cleanup on unmount, and reactive key support.
- Improved TypeScript support: Context-aware type inference and a single root tsconfig.json.
- Faster CLI: Implementation of internal sockets for communication, Node.js compile cache, and native file watching (fs.watch).
- Updated UI templates with improved accessibility and polish.
🐛 Bug Fixes
- Addressed inconsistencies in the data fetching layer.
- Improved file watcher performance on Windows and Linux by isolating app code from node_modules.
🔧 Affected Symbols
useAsyncDatauseFetch@nuxt/kit@nuxt/clitsconfig.json⚡ Deprecations
- Legacy utilities and features previously marked as deprecated in Nuxt 3 have been removed.