From Nuxt 2 to Nuxt 3: a rebuild, not an update

Moving an application from Nuxt 2 to Nuxt 3 changes more than a version number: Vue 2 becomes Vue 3, webpack 4 and Babel become Vite by default, the server becomes Nitro, and Vuex is no longer built in. In this article I describe what changes according to the official documentation, where the typical pitfalls are and in which order I approach such a migration: library first, then the move. It is based on a web application for a testing and inspection company that I moved with the team in two stages, in 2024 and 2025.

Why is this a rebuild and not an update?

Nuxt 3 stands on different foundations. The Nuxt migration overview names three major shifts: from Vue 2 to Vue 3 with the Composition API and <script setup> as the default, from webpack 4 and Babel to Vite or webpack 5 with esbuild, and from Nuxt as a runtime dependency to a minimal, standalone server compiled by Nitro. In my experience each of these shifts touches a large part of the code on its own. Together they mean that hardly a file stays the same.

The pressure comes from both sides. Vue 2 reached its end of life on 31 December 2023 and has not received any updates since, including security and browser compatibility fixes. Nuxt 2 has been unsupported since 30 June 2024.

A note on where things stand today: Nuxt 4 was released on 15 July 2025. If you start from Nuxt 2 today, check Nuxt 4 as your target. The big break, however, lies between Nuxt 2 and Nuxt 3, and that break is what this article is about.

What changes in configuration and build?

nuxt.config becomes an ES module using defineNuxtConfig, which comes with a typed schema. module.exports becomes export default, buildModules merges into modules, and the static/ folder is now public/. Nuxt loads a .env file itself, so importing dotenv in the configuration is no longer needed.

On the build side the documentation is clear: most of the previous build configuration in nuxt.config is ignored, including any custom Babel configuration. Its place is taken by the vite, webpack and postcss keys. The default is Vite through @nuxt/vite-builder. Webpack loaders and plugins from the old project therefore have to be checked one by one and replaced with their Vite counterpart where needed.

One place that is easy to overlook is runtime configuration. publicRuntimeConfig and privateRuntimeConfig merge into a single runtimeConfig. Its values are overridden at runtime by matching environment variables, and if you want to read environment variables in the application, this is the way to do it in Nuxt 3:

export default defineNuxtConfig({
  runtimeConfig: {
    apiSecret: '123',
    public: {
      apiBase: '/api',
    },
  },
})

The matching environment variables are NUXT_API_SECRET and NUXT_PUBLIC_API_BASE. In the browser only the keys under public are available, on the server the whole configuration. Secrets therefore never belong under public.

How do asyncData and fetch become the new data fetching?

The asyncData and fetch hooks no longer exist in this form. The documentation recommends replacing both with useAsyncData or useFetch. useAsyncData replaces both hooks and can do more than simply fetch data from an endpoint. useFetch is a convenience wrapper around it for the most common case, fetching from an endpoint:

const route = useRoute()
const { data: post, refresh } = await useFetch(`/api/posts/${route.params.id}`)

There is a lot of work here, because in Nuxt 2 data fetching, loading state and error handling are often spread across component, store and plugin. I use the rebuild to pull this logic together into composables. Then each data source has one place that pages and components share.

What happens to plugins, middleware, head and pages?

Plugins get a new format with exactly one argument, nuxtApp. inject becomes nuxtApp.provide, and access then goes through nuxtApp.$name. Files directly in the plugins/ folder and index files in its subfolders are registered automatically, and instead of the mode option the environment is part of the file name, for example .client.ts.

export default defineNuxtPlugin((nuxtApp) => {
  nuxtApp.provide('injected', () => 'my injected function')
})

Route middleware is written with defineNuxtRouteMiddleware and redirects with navigateTo. Nuxt recognises global middleware by its file name, for example auth.global.ts. If you access component state in the head, you switch to useHead.

Pages and layouts use different building blocks: app.vue becomes the central entry point, layouts use a <slot />, nested routes render through <NuxtPage>, and dynamic parameters are called [id] instead of _id. These are many small changes that work well as a checklist, and each of them has to be applied page by page.

Which Vue 3 changes affect your own code?

The more demanding part is often Vue itself. From the official migration guide, these are the breaking changes I run into most often in practice:

  • Filters are removed. The guide recommends replacing them with computed properties or methods.
  • $on, $off and $once are removed. A global event bus has to move to an external library such as mitt or tiny-emitter, or better, be replaced with props, events and shared state.
  • v-model on components works with modelValue and the update:modelValue event instead of value and input. The .sync modifier is gone, and in return several v-model bindings on one component are possible.
  • $listeners no longer exists, event listeners are now part of $attrs.
  • Instead of new Vue, createApp creates an app instance. Global registrations are therefore attached to the app, no longer to the Vue constructor.

Vue offers a migration build for the transition, @vue/compat, which runs Vue 3 with Vue 2 compatible behaviour. The Nuxt documentation, however, states that it currently cannot be used with Nuxt 3. In a Nuxt project this intermediate step does not exist. Dependencies are just as critical: libraries that rely on internal Vue 2 APIs need a Vue 3 version or a replacement. I make this list before the first change, because it often sets the schedule.

Why the component library first?

Components are where most Vue 2 specifics accumulate: v-model on custom inputs, forwarded $listeners, filters in templates. That is why I recommend rebuilding them first, isolated from the pages: library first, then the move. In the project for the testing and inspection company a modular component library in Storybook was built, together with reusable composables.

This has two benefits. Each component can be checked on its own in Storybook, with all its states and without the whole application running yet. And when the pages move afterwards, they assemble finished, tested building blocks instead of repairing old and new logic at the same time. Accessibility according to WCAG can be built in at this point too, because keyboard operation, focus and labels are created in the component and not again on every page.

I secured the rebuild with unit and snapshot tests in Vitest. For Nuxt there is @nuxt/test-utils with its own nuxt test environment, a Nuxt runtime environment for code that relies on Nuxt composables, auto-imports or the Nuxt context. mountSuspended mounts a component in this environment, with async setup and access to the injections of the Nuxt plugins, and a snapshot records the result:

const component = await mountSuspended(SomeComponent)
expect(component.text()).toMatchInlineSnapshot(
  '"This is an auto-imported component"',
)

Snapshot tests do not replace functional tests. In a migration they are still valuable, because they make every unintended change in the output visible.

Where does the Vuex store go?

Nuxt 3 no longer ships a Vuex integration. The documentation points to Pinia, which Vue recommends, registered through the @pinia/nuxt module. If you want to keep Vuex, you have to move to Vuex 4 yourself and register it with a plugin. In the project Pinia handles state management.

Pinia has two kinds of stores, defined with an options object or with a setup function. In a setup store, values created with ref() become state, values created with computed() become getters and functions become actions:

export const useCounterStore = defineStore('counter', () => {
  const count = ref(0)
  const doubleCount = computed(() => count.value * 2)
  function increment() {
    count.value++
  }
  return { count, doubleCount, increment }
})

A Vuex module can usually be turned into a store one to one. Mutations no longer exist: they become actions that change the state directly, or components write to the store directly. This makes the code shorter, but it means finding the places where components relied on mutations so far.

What I take away from the migration

  • Be honest about the scope: Vue 3, a new bundler, Nitro and a new store are four rebuilds at once.
  • Check dependencies first. Whatever has no Vue 3 version sets the schedule.
  • Library first, then the move: rebuild and test the components in isolation in Storybook, then the pages.
  • Bundle data fetching in composables instead of translating asyncData file by file.
  • Write tests before the rebuild, not after. Snapshots reveal differences that get lost when clicking through.
  • Build accessibility into the new components right away instead of retrofitting it later.

All articles

Legal Notice

DIGITALPASSION Ltd.

Tassou Papadopoulou 16
House 2
8270 Tremithousa, Cyprus
Email:
info@kevin-damiani.de
Register Number:
HE 454538
Represented by:
Kevin Damiani
VAT ID:
CY60039739L

IT Liability Insurance

exali AG
Franz-Kobinger-Str. 9, 86157 Augsburg

Dispute Resolution

We are not willing or obliged to participate in dispute resolution proceedings before a consumer arbitration board.

Liability for Content

As a service provider, we are responsible for our own content on these pages in accordance with general laws. However, liability is only possible from the time of knowledge of a specific infringement.

Copyright

The content and works created by the site operators on these pages are subject to German copyright law. Downloads and copies of this site are only permitted for private, non-commercial use.

Privacy Policy

The protection of your personal data is important to us. This privacy policy informs you about the processing of personal data on this website and in the iPad app DrawBook (see DrawBook).

Data Controller

Responsible for data processing on this website and in the DrawBook app is:

DIGITALPASSION Ltd.
Tassou Papadopoulou 16, House 2, 8270 Tremithousa, Cyprus
Email: info@kevin-damiani.de

Hosting

This website runs on our own server at Hostinger International Limited, 61 Lordou Vironos Street, 6023 Larnaca, Cyprus, in the data center in Frankfurt am Main; Hostinger processes the data on our behalf (Art. 28 GDPR). To deliver the page, our web server processes your IP address, the time, the page viewed and the referring page, and your browser identifier. It keeps no access log; it passes page views on only in shortened form for web analytics (see Web Analytics). If it cannot deliver the page, it writes an error line with the time, the page viewed and the referring page (both without parameters after the "?"), your browser identifier and your IP address shortened to the first 24 bits (IPv4) or 48 bits (IPv6). These lines are overwritten continuously: we keep at most 30 MB of them, and older ones are dropped as new ones arrive, so there is no period in days. In addition, Hostinger backs up the whole server once a week in a data center in Lithuania and keeps the two most recent backups. The legal basis is our legitimate interest in providing the website securely and reliably (Art. 6(1)(f) GDPR). You are not obliged to provide this data; without the transmission of your IP address, however, the website cannot be delivered.

Cookies and local storage

This website does not set any cookies and stores nothing in your browser's storage (neither localStorage nor sessionStorage). No identifiers for recognizing you are stored on your device, and there are no entries from third parties; how we count visits is described under Web Analytics.

Web Analytics

So that we know how often this website is visited, where visitors come from and which language version they read, our web server (see Hosting) evaluates each successfully loaded page view. No script runs in your browser for this, no cookies are set and nothing is read from or stored on your device. If your browser sends the Global Privacy Control or Do Not Track signal, the page view is not counted. It shortens the IP address (for IPv4 without the last byte, for IPv6 only the first 48 bits) and passes it on, together with the time, the page viewed, the referring page (both without parameters after the "?"), the browser identifier and the name of this website, to our own analytics software Umami, which runs on the same server (see Hosting). It does not pass on other details of the request, such as the language setting, and it writes no log in doing so. Umami stores neither the IP address nor the browser identifier, but derives browser, operating system and device type as well as country, region and city from them, plus page, referrer and time. It groups page views into visits using an identifier calculated from the shortened address, the browser identifier and a secret key that changes every day; page views from different days therefore cannot be linked. Umami does not count page views from recognizable bots. Umami deletes the data after 363 days. Backups are stored encrypted on a server we run ourselves in Cyprus and mirrored from there to storage in Germany that we also run ourselves; no copy is older than 400 days. We do not pass the data on to third parties. The legal basis is our legitimate interest in knowing the reach of the website and improving it (Art. 6(1)(f) GDPR); you can object under Art. 21 GDPR (see Your Rights), most easily by turning on Global Privacy Control or Do Not Track in your browser.

Fonts

This website uses locally hosted fonts (self-hosting). No connections are made to external servers such as Google Fonts.

Contact

If you contact us by email, your information will be stored for processing the request and for possible follow-up questions. We receive and store emails with our processor Fastmail Pty Ltd, Australia; there is no adequacy decision of the European Commission for Australia, so the transfer is based on the EU Standard Contractual Clauses in Fastmail's data processing agreement (available at fastmail.com/policies/dpa). Beyond that, we will not share this data without your consent. The legal basis is Art. 6(1)(b) GDPR if your request aims at concluding or performing a contract, otherwise our legitimate interest in answering it (Art. 6(1)(f) GDPR). We delete the data once the request has been dealt with, unless statutory retention obligations apply. Providing your information is voluntary; without an email address we cannot reply to you.

DrawBook

DrawBook is a free note-taking and drawing app for iPad that DIGITALPASSION Ltd. offers on the App Store. We run no server for DrawBook: we receive neither your notebooks nor your AI requests or API keys. The app needs no DrawBook account, and it contains no analytics, no advertising and no tracking.

Notebooks, drawings, typed text and imported PDF pages stay on your device, in the app's protected storage, and are excluded from automatic device backups. If you export or share something, you decide where the copy goes. Deleting the app also deletes its notebooks.

You can also use the AI chat "Drawing AI". It only works with your own API key for OpenRouter, Ollama Cloud, Anthropic (Claude) or OpenAI; the app stores the key in your device's Keychain. Nothing is sent until you tap "Activate" under "AI configuration" and confirm the dialog that follows. This consent applies to the selected provider, model and image setting, and the app checks it before and after every request. "Deactivate" withdraws it, and "Remove Saved API Key" deletes the key.

Requests go over HTTPS directly from your device to the selected provider (openrouter.ai, ollama.com, api.anthropic.com or api.openai.com). They contain your prompt, the recent conversation and a summary of the page. When the AI reads the page, editable objects such as typed text and shapes are added, along with handwriting recognized on your device and the coordinates of your strokes. If "Send Page as Image to AI" is on (off by default), the AI can also request an image of the page, including an imported PDF background. OpenRouter may forward a request to the actual model provider.

DIGITALPASSION does not receive this data. The app transfers it only with your consent (Art. 6(1)(a) GDPR) to the provider, which processes it under its own terms as an independent controller. How long the provider keeps it is set by its terms; you exercise your rights regarding data it has already received with the provider. DrawBook keeps the chat history only in memory, and "New thread" clears it. We answer privacy questions about DrawBook at info@kevin-damiani.de.

Your Rights

You have the right to:

  • Information about your stored data (Art. 15 GDPR)
  • Correction of inaccurate data (Art. 16 GDPR)
  • Deletion of your data (Art. 17 GDPR)
  • Restriction of processing (Art. 18 GDPR)
  • Data portability, where processing is based on consent or a contract and carried out by automated means (Art. 20 GDPR)
  • Withdrawal of consent given, at any time and with effect for the future (Art. 7(3) GDPR)

In case of complaints, you can contact the responsible data protection supervisory authority (Art. 77 GDPR).

Right to object

Where we process data on the basis of legitimate interests (Art. 6(1)(f) GDPR), you can object at any time on grounds relating to your particular situation (Art. 21 GDPR). An informal email is sufficient.

SSL Encryption

This website uses SSL encryption for security reasons. You can recognize an encrypted connection by the lock symbol in your browser's address bar.

Changes

We reserve the right to adapt this privacy policy to changes in the law or in the service.

Last updated: November 2026