An Overview of Changes in Nuxt 4

When you hear "major version upgrade," it often triggers anxiety about extensive rewrites and breaking changes. However, Nuxt 4 takes a different approach. As Daniel Roe, a core team member, puts it: "I'm looking forward to taking half the day to upgrade our project, rather than having to take 6 months to re-write the entire app." This sentiment perfectly captures the essence of Nuxt 4 - it's a major release focused on sustainable improvements rather than revolutionary changes.
What’s New in Nuxt 4 Course
We’ve gone over all the content featured in this article and more in our video course What’s New in Nuxt 4. If you want to dive deeper into changes in Nuxt 4, go watch the course now!
Directory Structure: The Most Significant Change
The most notable change in Nuxt 4 is its reorganized directory structure, designed to improve development experience and performance. This restructuring brings two major benefits:
- Enhanced File Watching Performance: The new structure optimizes Chokidar's file watching capabilities, resulting in faster development cycles
- Clear Separation of Concerns: There's now a distinct boundary between client/server code and app/API functionality
Key Directory Changes
- A new
shared/directory has been introduced for code that needs to be accessible across both client and server environments - Better organization of server-side and client-side code
- Clearer distinction between application and API layers
- Works for
utilsandtypes
Breaking Changes: What You Need to Know
Major Changes
- Shallow Data Reactivity
useAsyncDataanduseFetchnow implement shallow reactivity by default- This change improves performance while maintaining practical functionality
- Normalized Component Names
- Component naming conventions have been standardized the folder + file name combo not only in Nuxt-land but also for ALL cases where a component name is passed as a string in Vue (like
KeepAlive) - This also applies to the name of components within the devtools
- Component naming conventions have been standardized the folder + file name combo not only in Nuxt-land but also for ALL cases where a component name is passed as a string in Vue (like
- Singleton Data Fetching Layer
- Reactive data from
useFetchanduseAsyncDatathat use the SAME key will refer to a single reactive ref. Mostly this means you should be careful to provide the same - getCachedData now fires for refetches triggered by watchers and
refreshNuxtDataand comes with actxargument for know what caused the attempted refetch.
- Reactive data from
Additional Notable Changes
- The
window.__NUXT__object has been removed - Directory index scanning of modules has been updated
- Route metadata deduplication has been implemented
- Nuxt will now only inline styles for Vue components, not global CSS.
- Default data and error values in useAsyncData and useFetch now undefined instead of null
Upgrading to Nuxt 4: A Streamlined Process
Nuxt has provided official codemods to make the upgrade process as smooth as possible. Here's how you can try out Nuxt 4 features:
Enable Compatibility Mode in Nuxt 3
# Add the following to your nuxt.config.ts
export default defineNuxtConfig({
future: {
compatibilityVersion: 4,
},
})
Using the Official Codemod
npx codemod@latest nuxt/4/migration-recipeThis codemod will automatically handle many of the necessary changes for your upgrade but it’s not perfect, so some manual review with the upgrade guide at hand will also be required.
Additional Resources
To learn more about Nuxt 4 and stay updated with the latest developments:
- Official Documentation
- Community Resources
Conclusion
Nuxt 4 represents a thoughtful evolution of the framework, prioritizing developer experience while maintaining stability. The focus on making the upgrade process as painless as possible shows the team's commitment to their community. Whether you're maintaining a large application or starting a new project, Nuxt 4 provides a solid foundation for modern web development.
Start learning Vue.js for free

Comments
Latest Vue School Articles
5 Component Design Patterns to Boost Your Vue.js Applications

Vibe Coding a Collaborative Editor with Comment Support with Nuxt UI and Jazz

Our goal is to be the number one source of Vue.js knowledge for all skill levels. We offer the knowledge of our industry leaders through awesome video courses for a ridiculously low price.
More than 200.000 users have already joined us. You are welcome too!
© All rights reserved. Made with ❤️ by BitterBrains, Inc.


