v4 Compatibility mode
In Nuxt v3 to future proof for v4 you can run in compatibility mode 4
which uses the anticipated v4 directory structure. The biggest change is separating client code into app
folder to make it a sister folder to the server
folder.
Enable in nuxt.config.ts
export default defineNuxtConfig({
future: {
compatibilityVersion: 4,
}
})
Dir Changes
Nuxt 3 Default | Nuxt 4 Compatibility |
---|
/app.vue | /app/app.vue |
/pages | /app/pages |
/layouts | /app/layouts |
/components | /app/components |
Nuxt 3 Unchanged |
---|
/content |
/app/router.options.js |