Upgrading Vue Enterprise Projects to Nuxt 4

Migrating enterprise projects is always challenging, particularly when dealing with major version shifts like Nuxt 2 → Nuxt 3, and now the streamlined directory shifts in Nuxt 4.

In my work at IDG, I led migration operations resolving breaking changes and adapting layouts to composition syntax. Here is a checklist of critical factors to watch for.

---

1. The Directory Restructure

Nuxt 4 consolidates code files inside a unified app/ folder structure by default (pages, components, layouts, middleware, composables), leaving configs and public resources in the root.

// bash
# Nuxt 4 structure ├── app/ │ ├── components/ │ ├── layouts/ │ ├── pages/ │ └── app.vue ├── public/ ├── server/ ├── nuxt.config.ts └── package.json

To preserve the old directory layout during migration, you can configure compatibility mode in nuxt.config.ts:

// typescript
export default defineNuxtConfig({ future: { compatibilityVersion: 4 } })

---

2. Smart Component Resolution

Nuxt 4 has updated component autoloading properties. Nested folders now auto-resolve prefixing parent folder names to components. For instance:

  • Components inside components/dashboard/Sidebar.vue must be called as in views instead of just .

---

Summary Checklist

  • [x] Configure compatibility version variables in configuration files.
  • [x] Rename imports referencing nested components to use prefix names.
  • [x] Audit global composables: ensure standard imports are explicitly defined.
  • [x] Test Server-Side Rendering (SSR) page-load performance and hydrate states.

Migrating early ensures you benefit from Vite's updated hot-reload speeds, reduced build bundle sizes, and optimal TypeScript compilation checks.