---
title: "Nuxt 4.7"
description: "Nuxt 4.7 lets you try Nitro v3, adds experimental WebMCP support, shows type and lint problems in the dev overlay and validates runtime config."
canonical_url: "https://nuxt.com/blog/v4-7"
---
# Nuxt 4.7

> Nuxt 4.7 lets you try Nitro v3, adds experimental WebMCP support, shows type and lint problems in the dev overlay and validates runtime config.

Nuxt 4.7 is out, with around 350 commits since v4.6.4. 🎉

It's a release with something for everyone. You can try out Nitro v3, offer your app's actions to AI agents in the browser, see type errors and lint warnings right next to your runtime errors, and validate your runtime config with a schema. And it should be even faster, especially for server rendering, hydration and installs.

## 📣 Some News

### Try Nitro v3 Today

The biggest thing in this release is that you can now build your Nuxt 4 app with [Nitro v3](https://nitro.build) ([#37101](https://github.com/nuxt/nuxt/pull/37101)). Nitro v3 is what Nuxt 5 is built on, so this is a way to move your server code (and your modules) over before you upgrade Nuxt itself.

There's no config to change. Add `nitro` to your dependencies:

::code-group{sync="pm"}
```bash [npm]
npm install nitro
```

```bash [yarn]
yarn add nitro
```

```bash [pnpm]
pnpm add nitro
```

```bash [bun]
bun add nitro
```

```bash [deno]
deno add npm:nitro
```
::

If `nitro` is in your `package.json`, Nuxt builds with Nitro v3. To go back, just remove it.

![nuxt build with Nitro v3](https://nuxt.com/assets/blog/v4-7/nitro-v3-build-dark.png)

::caution
This is **highly experimental**. Nitro v3 is still a release candidate, and there are no guarantees. Please try it on a branch, not in production. 🙏
::

Do give Nitro v3 a try! On our benchmark app with about 170 pages, the same app on 4.7 served 33% more requests per second on its home page with Nitro v3 than with Nitro v2 (926 to 1,236), and 44% more on a page with 1,000 links (219 to 316), with identical HTML.

Most Nuxt 4 apps (and the modules they use) were written for Nitro v2 and h3 v1. So, on Nuxt 4, Nitro v3 runs with a compatibility layer called `nitroLegacy`. It keeps imports from `h3`, `nitropack` and `#imports` resolving, keeps the Nitro v2 auto-imports, `useRuntimeConfig(event)`, `event.node` and the Nitro v2 hooks working, and keeps a long list of h3 v1 behaviours, from `sendRedirect` ending the response to the `cache-control` headers cached routes send.

Once things are working, turn the layer off to find the code that still depends on it:

```ts [nuxt.config.ts]
export default defineNuxtConfig({
  nitroLegacy: false,
})
```

A few things change with Nitro v3 regardless. The main one is route rules: Nitro v3 matches them with [a different pattern syntax](https://nuxt.com/docs/getting-started/upgrade#route-rule-patterns), so `/blog/*` now also applies to `/blog/2026/hello`. Nuxt warns about each rule whose meaning changes, and stops on a rule that uses more than one wildcard (like `/api/*/items/**`), which you can rewrite with a named parameter (`/api/:id/items/**`). Your app matches route rules the same way as the server, so Nuxt-only route rules like `appMiddleware` and `ssr` apply to the same paths on both.

The other is imports. If your server code imported a package your app didn't depend on, Nitro v2 fell back to Nuxt's own dependencies. Nitro v3 doesn't, so `nuxt dev` fails with something like `Cannot find package 'ufo'`. Make sure every package your server code imports is in your `package.json`.

::read-more{to="https://nuxt.com/docs/getting-started/upgrade#testing-nitro-v3"}
Read the full list of what changes with Nitro v3 on Nuxt 4.
::

If something breaks for you (and it might), please [open an issue](https://github.com/nuxt/nuxt/issues/new/choose) and mention Nitro v3. Every report helps make the move to Nuxt 5 smoother for everyone. ❤️

### Nuxt CLI 4.1

Nuxt 4.7 also comes with [Nuxt CLI 4.1](https://github.com/nuxt/cli/releases/tag/v4.1.0).

The most visible change is in `nuxt build`. Instead of printing each tool's logs one after the other, the CLI now renders the whole production build itself from a set of new build hooks ([nuxt/cli#1662](https://github.com/nuxt/cli/pull/1662), [#37194](https://github.com/nuxt/nuxt/pull/37194)). Thanks to [@atinux](https://github.com/atinux) for this one. ❤️ It works the same way with every builder (Vite, webpack, Rspack, Rsbuild) and every server builder (Nitro v2, Nitro v3 and `@nuxt/vite-server`):

![nuxt build in Nuxt 4.7 with Nuxt CLI 4.1](https://nuxt.com/assets/blog/v4-7/build-after-dark.png)

`nuxt generate` shows the prerendered routes in the same way, and ends by suggesting where to deploy:

![nuxt generate listing prerendered routes](https://nuxt.com/assets/blog/v4-7/prerender-after-dark.png)

There's more:

- `nuxt dev --https` serves over HTTP/2, so the browser loads the modules of a page in parallel on a single connection, thanks to [@ProgramRipper](https://github.com/ProgramRipper) ([nuxt/cli#1694](https://github.com/nuxt/cli/pull/1694))
- you can click and scroll inside the panes of the dev panel, thanks to [@Flo0806](https://github.com/Flo0806) ([nuxt/cli#1665](https://github.com/nuxt/cli/pull/1665))
- copying a URL or an error works without a system clipboard (for example over SSH, or in a container), as long as your terminal supports it ([nuxt/cli#1693](https://github.com/nuxt/cli/pull/1693))
- new `nuxt module build` and `nuxt module prepare` commands for module authors ([nuxt/cli#1687](https://github.com/nuxt/cli/pull/1687)), paving the way for `@nuxt/module-builder` v2, built on `tsdown` with support for TypeScript 7.1 (watch this space!)
- logs from Nuxt and modules stay inside the build output rather than breaking out of it ([nuxt/cli#1705](https://github.com/nuxt/cli/pull/1705))
- a route that fails to prerender is listed with the pages that link to it, with [nitropack v2.14](https://github.com/nitrojs/nitro-v2/releases/tag/v2.14.0) ([#37245](https://github.com/nuxt/nuxt/pull/37245))

## 🤖 WebMCP (Experimental)

[WebMCP](https://webmachinelearning.github.io/webmcp/) is a proposed browser API that lets a page offer *tools* to AI agents running in the browser. That means an agent can add something to a cart or submit a form without guessing which button to click.

This started from [@sdras](https://github.com/sdras)'s proposal for Vue and WebMCP, and much of the shape of it comes from her work and feedback ([#37195](https://github.com/nuxt/nuxt/pull/37195)). Thank you, Sarah! 💚

```ts [nuxt.config.ts]
export default defineNuxtConfig({
  experimental: {
    webmcp: true,
  },
})
```

Most of what an agent needs is already bound in your templates, so tagging a function with `@tool` is enough:

```vue [app/pages/index.vue]
<script setup lang="ts">
const { data: products } = await useFetch('/api/products')
const cart = useCart()

/**
 * Add one of a product to the cart. Use when the user wants to buy something.
 * @tool
 */
function addToCart (sku: string) {
  cart.value.push(sku)
}
</script>

<template>
  <ul>
    <li v-for="product in products" :key="product.sku">
      {{ product.name }}
      <button :disabled="!product.inStock" @click="addToCart(product.sku)">
        Add
      </button>
    </li>
  </ul>
</template>
```

This registers an `add_to_cart` tool. The arguments come from the template, so an agent can only do what a user could click, and it can't run while the button is disabled. Inside a `v-for`, the `:key` becomes a `target` the agent picks, and a shared `list_targets` tool lists what's on screen.

A `@tool` bound to `@submit` becomes a form tool. Its input is the form's `v-model` bindings, and a call fills in the form and submits it for real, so your own validation and submit handler run just as they would for a person:

```vue [app/pages/contact.vue]
<script setup lang="ts">
import { z } from 'zod'

const contactSchema = z.object({ email: z.email(), message: z.string().min(5) })
const form = reactive({ email: '', message: '' })

/**
 * Send a message to the shop. Use when the user has a question about an order.
 * @tool
 * @input contactSchema
 */
async function sendMessage () {
  await $fetch('/api/contact', { method: 'POST', body: form })
  return 'Sent.'
}
</script>

<template>
  <form @submit.prevent="sendMessage">
    <label>Email <input v-model="form.email" type="email"></label>
    <label>Message <textarea v-model="form.message" /></label>
    <button type="submit">Send</button>
  </form>
</template>
```

A call can only fill in what the user could: a field has to be rendered, and not disabled or read-only. Flags after `@tool` describe the action (`readonly`, `consequential`, `confirm`, `values`), and for tools that don't map to a single control there's `defineAgentTool()` and `useAgentTool()`:

```vue [app/pages/products.vue]
<script setup lang="ts">
import { z } from 'zod'

const searchProducts = defineAgentTool({
  name: 'search_products',
  description: 'Find products by name. Use when the user asks what is for sale.',
  input: z.object({ query: z.string() }),
  annotations: { readOnlyHint: true },
  execute: ({ query }, { signal }) => $fetch('/api/products', { query: { q: query }, signal }),
})

useAgentTool(searchProducts)
</script>
```

Finally, `useAgentActivity()` lets you show the user what an agent is doing, and stop it:

```vue [app/components/AgentStatus.vue]
<script setup lang="ts">
const { current, stop } = useAgentActivity()
</script>

<template>
  <p v-if="current">
    {{ current.message }} <button @click="stop">Stop</button>
  </p>
</template>
```

::themed-video
```yaml [props]
light: /assets/blog/v4-7/webmcp-agent-run-light.mp4
light-poster: /assets/blog/v4-7/webmcp-agent-run-light.png
dark: /assets/blog/v4-7/webmcp-agent-run-dark.mp4
dark-poster: /assets/blog/v4-7/webmcp-agent-run-dark.png
controls: true
loop: true
class: rounded-lg
```
::

Nuxt also registers a `navigate` tool listing your pages, warns at build time about bindings that can't become tools (or descriptions that don't follow Chrome's [tool design guidance](https://github.com/GoogleChromeLabs/webmcp-tools)), and in development writes the tools of each page you visit to `.nuxt/webmcp/schema.json`, ready for [`webmcp-evals`](https://github.com/GoogleChromeLabs/webmcp-tools/tree/main/webmcp-evals).

::note
The WebMCP spec is still moving, and the API is in early preview in Chrome behind a flag. In browsers without it, nothing registers and your app behaves exactly as before.
::

::read-more{to="https://nuxt.com/docs/guide/ai/webmcp"}
Read the WebMCP guide.
::

## 🔎 All Your Problems in One Place

Nuxt 4.6 brought [`my-bad`](https://github.com/danielroe/my-bad) error pages to development. In 4.7, with `my-bad` v1 and [`vite-plugin-checker` v1](https://github.com/fi3ework/vite-plugin-checker/releases/tag/v1.0.0), the same badge in the corner of your page also collects *problems* ([#36918](https://github.com/nuxt/nuxt/pull/36918)):

- type errors, when you enable `typescript.typeCheck`
- any other checker you add to Vite, such as ESLint
- Vue compiler warnings that used to be lost in the terminal ([#36967](https://github.com/nuxt/nuxt/pull/36967))
- Nuxt's own warnings from scanning your app, such as duplicate component names or conflicting imports ([#36969](https://github.com/nuxt/nuxt/pull/36969))

Each source becomes a 'problem set'. The badge sums them up in one pill, and clicking it opens a drawer beside the page, grouped by source, with source snippets, links to the rule docs and a button to open each one in your editor.

![The my-bad badge in the corner of the page, showing 3 errors](https://nuxt.com/assets/blog/v4-7/problems-badge-light.png){.dark:hidden}
![The my-bad badge in the corner of the page, showing 3 errors](https://nuxt.com/assets/blog/v4-7/problems-badge-dark.png){.hidden.dark:block}

![The problems drawer with ESLint and vue-tsc problem sets](https://nuxt.com/assets/blog/v4-7/problems-drawer-light.png){.dark:hidden}
![The problems drawer with ESLint and vue-tsc problem sets](https://nuxt.com/assets/blog/v4-7/problems-drawer-dark.png){.hidden.dark:block}

If you're using [Nuxt DevTools v4](https://nuxt.com/blog/devtools-v4), the same problems are also in a Problems panel in the DevTools dock.

![The Problems panel open from the Nuxt DevTools v4 dock, listing three vue-tsc errors](https://nuxt.com/assets/blog/v4-7/devtools-problems-light.png){.dark:hidden}
![The Problems panel open from the Nuxt DevTools v4 dock, listing three vue-tsc errors](https://nuxt.com/assets/blog/v4-7/devtools-problems-dark.png){.hidden.dark:block}

Type checking in development used to mean type checking in production builds too. Thanks to [@sakaintp](https://github.com/sakaintp), you can now choose ([#36164](https://github.com/nuxt/nuxt/pull/36164)):

```ts [nuxt.config.ts]
export default defineNuxtConfig({
  typescript: {
    typeCheck: 'dev', // `true`, 'build' or 'dev'
  },
})
```

This is handy if you already run `nuxt typecheck` as a separate CI step.

## 🩺 Template Diagnostics

The Vue compiler can't know about your pages or your server components, but Nuxt can. So Nuxt now checks your templates for a few mistakes that only make sense with that knowledge ([#36754](https://github.com/nuxt/nuxt/pull/36754)):

- a `<NuxtLink>` whose static `to` doesn't match any page ([`NUXT_B4025`](https://nuxt.com/docs/errors/b4025))
- `v-on` or `v-model` on a server component, which can't work ([`NUXT_B3014`](https://nuxt.com/docs/errors/b3014))
- a function or class instance passed as a prop to a server component ([`NUXT_B3015`](https://nuxt.com/docs/errors/b3015))

![A NUXT_B4025 warning for a NuxtLink to a page that does not exist](https://nuxt.com/assets/blog/v4-7/template-diagnostic-dark.png)

In development, these also show up on every open page (as a problem set, of course) until you fix them. This is on by default, and you can turn it off with `experimental.templateDiagnostics: false`.

::read-more{to="https://nuxt.com/docs/guide/going-further/experimental-features#templatediagnostics"}
Read more about template diagnostics.
::

## 🧯 Server-Side Error Boundaries

`<NuxtErrorBoundary>` used to only catch errors on the client. A component that threw while server rendering went straight past it to your error page.

With `experimental.ssrErrorBoundary`, it now catches errors on the server too ([#36990](https://github.com/nuxt/nuxt/pull/36990)):

```vue [app/pages/index.vue]
<template>
  <NuxtErrorBoundary>
    <BrokenWidget />
    <template #error="{ error, clearBoundaryError }">
      <p>Widget unavailable</p>
      <button @click="clearBoundaryError">
        Retry
      </button>
    </template>
  </NuxtErrorBoundary>
</template>
```

If `<BrokenWidget>` throws on the server, the response is a `200` with the rest of the page intact and the `#error` slot in its place. The client then hydrates into the same state. In production, errors that aren't HTTP errors reach the slot as a plain `500`, so server error messages stay out of your HTML.

![A page where one widget failed during SSR and the rest rendered](https://nuxt.com/assets/blog/v4-7/error-boundary-light.png){.dark:hidden}
![A page where one widget failed during SSR and the rest rendered](https://nuxt.com/assets/blog/v4-7/error-boundary-dark.png){.hidden.dark:block}

```ts [nuxt.config.ts]
export default defineNuxtConfig({
  experimental: {
    ssrErrorBoundary: true, // enabled with `future.compatibilityVersion: 5`
  },
})
```

There's also a new `retry-on-client` prop, which serves the `#error` slot in the HTML and then tries the real content again in the browser. This is useful for a component that only works on the client, and it replaces `<NuxtClientFallback>`, which is now deprecated.

You might also notice that the slot now exposes `clearBoundaryError` ([#37079](https://github.com/nuxt/nuxt/pull/37079)). It's the same method as `clearError`, renamed to avoid a footgun: if you forgot to destructure `clearError` from the slot props, your template would call the *global* `clearError` instead, and the boundary would stay broken.

::read-more{to="https://nuxt.com/docs/api/components/nuxt-error-boundary"}
Read more about `<NuxtErrorBoundary>`.
::

## ✅ Validated Runtime Config

Runtime config values have always been typed from their defaults, and environment variables were cast with `destr`. That meant you couldn't really declare a required value, or an enum, and occasionally a 'number-looking' string such as `4848e0` turned into a number. 😬

Now any value in `runtimeConfig` can be a [Standard Schema](https://standardschema.dev), such as one from [Zod](https://zod.dev), [ArkType](https://arktype.io) or [Valibot](https://valibot.dev) ([#36905](https://github.com/nuxt/nuxt/pull/36905)):

```ts [nuxt.config.ts]
import { z } from 'zod'

export default defineNuxtConfig({
  runtimeConfig: {
    apiSecret: z.string(), // required, so it must be set at runtime
    session: z.object({
      maxAge: z.number().int().default(60 * 60),
      secure: z.boolean().default(true),
    }),
    public: {
      mode: z.enum(['preview', 'production']).default('production'),
    },
  },
})
```

The schema sets the type, and its default (if any) is the default value. Environment variables are converted to that type when the server starts, and if a value is missing or can't be converted, the server doesn't start, and you get a single error listing everything that's wrong:

![A NUXT_E8014 error listing a missing runtime config value](https://nuxt.com/assets/blog/v4-7/runtime-config-error-dark.png)

The schema itself never ends up in your server bundle. Nuxt compiles it at build time into a tiny description (types, required values, enums and unions). Modules can declare schemas too, with `updateRuntimeConfig()`.

We may add more validations later, but for now the list is intentionally short so that the server still starts quickly.

::read-more{to="https://nuxt.com/docs/guide/going-further/runtime-config#validating-with-a-schema"}
Read more about validating runtime config.
::

## 🚀 Performance

We spent a lot of this release profiling. Here's how 4.7 compares to 4.6.4 on the starter app from [e18e's framework benchmarks](https://github.com/e18e/framework-performance), and on our own benchmark apps:

|                                                          | v4.6.4               | v4.7.0              |      |
| -------------------------------------------------------- | -------------------- | ------------------- | ---- |
| installed packages, starter                              | 523                  | 473                 | -50  |
| `node_modules`, starter                                  | 226.9 MB             | 208.4 MB            | -8%  |
| server output, starter                                   | 2.17 MB              | 1.23 MB             | -43% |
| initial page load, starter                               | 80.4 kB, 14 requests | 66.3 kB, 3 requests | -18% |
| SSR throughput, starter                                  | 245 req/s            | 292 req/s           | +19% |
| first contentful paint, starter (SSR)                    | 90.7 ms              | 79.2 ms             | -13% |
| SSR throughput, a page with 1,000 `<NuxtLink>`s          | 88 req/s             | 218 req/s           | 2.5x |
| SSR throughput, app with ~170 pages, with `staticRoutes` | 890 req/s            | 1,976 req/s         | 2.2x |
| hydration, Nuxt UI landing page                          | 757 ms               | 644 ms              | -15% |
| total blocking time, Nuxt UI landing page                | 276 ms               | 180 ms              | -35% |

`nuxt build` is about 7% faster on the large app and about 6% slower on the starter, and `nuxt dev` starts as quickly as before. Here's where the rest comes from.

### A Lighter Client

`ofetch` is left out of the client bundle when nothing uses `$fetch` ([#35790](https://github.com/nuxt/nuxt/pull/35790)), and so is unhead when nothing on the client touches the head ([#37035](https://github.com/nuxt/nuxt/pull/37035), [#37243](https://github.com/nuxt/nuxt/pull/37243)). If your app doesn't have its own `error.vue`, unhead now arrives with the built-in error page when one renders, which takes about 6 kB gzip off the entry of a minimal app.

Static `useHead()` and `useSeoMeta()` calls in `app.vue` are hoisted into the server renderer ([#37048](https://github.com/nuxt/nuxt/pull/37048)), so SPA shells get them in the HTML too.

Nuxt also requests fewer files before hydration: on our Nuxt UI benchmark page, the browser now loads 6 JavaScript files up front instead of 18.

`<NuxtLink>`s with a static internal `to` now compile to a plain anchor in production client builds, with no component instance at all ([#36904](https://github.com/nuxt/nuxt/pull/36904)), and page component names are set at build time ([#36902](https://github.com/nuxt/nuxt/pull/36902)).

### Faster Hydration

Most of the hydration cost on a typical marketing page turned out to be V8 lazily compiling functions the first time they ran. Nuxt now adds [V8 compile hints](https://v8.dev/blog/explicit-compile-hints) to the entry, layout and page chunks, so Chrome compiles them off the main thread while they download ([#36758](https://github.com/nuxt/nuxt/pull/36758)). In the measurements in that PR, hydration of a heavy landing page went from 477 ms to 311 ms, and total blocking time from 137 ms to 40 ms.

Nuxt also lets the browser paint before hydrating, and yields between boot phases so hydration doesn't extend one long task ([#36760](https://github.com/nuxt/nuxt/pull/36760)). Prefetch hints for lazy chunks wait until the app is ready, so they don't compete with the resources the page needs right now ([#36794](https://github.com/nuxt/nuxt/pull/36794), [#36878](https://github.com/nuxt/nuxt/pull/36878)).

### Faster Server Rendering

There's a new opt-in `experimental.staticRoutes` option ([#36867](https://github.com/nuxt/nuxt/pull/36867)). By default, Nuxt creates a fresh vue-router matcher for every server request, in case your app adds routes at runtime. If it doesn't, you can tell Nuxt your routes are fixed at build time:

```ts [nuxt.config.ts]
export default defineNuxtConfig({
  experimental: {
    staticRoutes: true,
  },
})
```

The server then builds the route matcher once, and on our benchmark app with about 170 pages this more than doubles throughput for a small page (890 to 1,976 requests per second). It also enables `early404`. The trade-off is that `router.addRoute()`, `removeRoute()` and `clearRoutes()` throw (and disappear from the type of `useRouter()`), so add routes with the `pages:extend` hook instead.

::tip
This is really worth enabling. If you don't add routes at runtime, it's free performance. 🔥
::

::read-more{to="https://nuxt.com/docs/guide/going-further/experimental-features#staticroutes"}
Read more about `staticRoutes`.
::

Beyond that, rendered HTML is encoded chunk by chunk ([#36719](https://github.com/nuxt/nuxt/pull/36719), [#36892](https://github.com/nuxt/nuxt/pull/36892)), which makes a surprising difference: a single `→` anywhere in a template made V8 encode the whole document as a two-byte string. There are also a number of smaller per-request improvements ([#36890](https://github.com/nuxt/nuxt/pull/36890)).

### Builds and Dev

- with `experimental.viteEnvironmentApi` (or `compatibilityVersion: 5`), the client and server are built at the same time, which is about 11% faster on a starter app ([#37047](https://github.com/nuxt/nuxt/pull/37047)), with `experimental.parallelBuild: false` as an opt-out
- auto-imported components are resolved inside the Vue template compiler instead of with a separate pass afterwards ([#36763](https://github.com/nuxt/nuxt/pull/36763)), and as a bonus, lazy hydration props now work in `<template lang="pug">` 🎉
- with `experimental.decorators`, Babel only runs on server files that actually contain a decorator, making builds about 30% faster ([#37053](https://github.com/nuxt/nuxt/pull/37053))
- `@vitejs/plugin-vue-jsx` (and Babel with it) only loads when you have a JSX/TSX file ([#37054](https://github.com/nuxt/nuxt/pull/37054))
- `nuxt.schema` files load natively without `jiti`, from about 100 ms to 3 ms ([#37027](https://github.com/nuxt/nuxt/pull/37027))
- Vite now scans the app directory of every layer when pre-bundling dependencies, so cold `nuxt dev` reloads the page far less often ([#36777](https://github.com/nuxt/nuxt/pull/36777))
- in development, a request that's still rendering when the server rebuilds now finishes on the old code instead of failing with a 503, which you can tune with `nitro.devServer.drain` ([#37245](https://github.com/nuxt/nuxt/pull/37245))

A huge thank-you to [@onmax](https://github.com/onmax), who sent over twenty performance PRs for this release, from transform filters and route tree reuse to keeping HMR fast when you edit a composable. ❤️

The build profiler is also a lot more accurate: it now measures the CPU time of each hook, so a hook that is only waiting no longer looks like the most expensive one ([#37052](https://github.com/nuxt/nuxt/pull/37052)).

### Nuxt DevTools, On Demand

Thanks to [@antfu](https://github.com/antfu), `nuxt` no longer depends on `@nuxt/devtools` directly ([#36581](https://github.com/nuxt/nuxt/pull/36581)). Instead, it ships the tiny [`@nuxt/devtools-onboard`](https://www.npmjs.com/package/@nuxt/devtools-onboard). If you have Nuxt DevTools installed (v3 or v4), it loads it. If not, `nuxt dev` shows a small button that installs it for you (after you confirm in the terminal).

That makes a fresh install of Nuxt a lot smaller, and lets you pick DevTools v3 or v4.

## 🦀 Rsbuild Builder

Thanks to [@Nsttt](https://github.com/Nsttt), there's a new `@nuxt/rsbuild-builder`, which hands your build to [Rsbuild](https://rsbuild.rs) itself ([#36499](https://github.com/nuxt/nuxt/pull/36499)). Client and server are Rsbuild environments, Vue goes through `@rsbuild/plugin-vue`, and CSS through Lightning CSS and PostCSS.

```ts [nuxt.config.ts]
export default defineNuxtConfig({
  builder: 'rsbuild',
})
```

It replaces `@nuxt/rspack-builder`, which is now deprecated (it still works, with a warning). The upgrade guide shows [how to switch](https://nuxt.com/docs/getting-started/upgrade#moving-to-the-rsbuild-builder). Modules can use `extendRsbuildConfig()` and `addRsbuildPlugin()`, and `addRspackPlugin()` keeps working.

## 🧰 For Module Authors

### Renderer Plugins

Some modules need to add to the initial HTML. For example, `@nuxtjs/color-mode` injects a small script. On `@nuxt/vite-server` there's no Nitro to register a plugin with, so this needed a new place to live.

Renderer plugins attach to the renderer, rather than to a particular server, so they work with any server builder ([#36601](https://github.com/nuxt/nuxt/pull/36601)):

```ts [module.ts]
addRendererPlugin(resolve('./runtime/server/renderer'))
```

```ts [runtime/server/renderer.ts]
import type { RendererPlugin } from 'nuxt/server'

export default (({ hooks }) => {
  hooks.hook('render:html', (html) => {
    html.head.push(`<script>${script}</script>`)
  })
}) satisfies RendererPlugin
```

On an older Nuxt, `addRendererPlugin` registers the same file as a Nitro plugin. There's also a new `render:document` hook, which is called with the finished HTML document of a response that isn't streamed, after every `render:html` listener has run ([#36989](https://github.com/nuxt/nuxt/pull/36989)).

### And More

- `build:environment:start`, `build:environment:done` and `build:prerender:*` hooks report every production bundle and prerendered route, whatever the builder ([#37194](https://github.com/nuxt/nuxt/pull/37194))
- `updateRuntimeConfig()` accepts [schemas](https://nuxt.com/docs/api/kit/runtime-config#schemas) for your module's options
- `extendRsbuildConfig()`, `addRsbuildPlugin()`, and an `rsbuild` variant for `addBuildPlugin()`
- `defineHandler` from `nuxt/server`, with `defineEventHandler` as an alias, matching Nitro v3 (thanks to [@atinux](https://github.com/atinux), [#36929](https://github.com/nuxt/nuxt/pull/36929))
- a `nuxt.request` tracing channel around each request, so APM tools get the same span hierarchy with any server builder (thanks to [@logaretm](https://github.com/logaretm), [#36483](https://github.com/nuxt/nuxt/pull/36483))

## 🛠️ Other Improvements

`addRouteMiddleware` now returns a function that removes the middleware again ([#37080](https://github.com/nuxt/nuxt/pull/37080)):

```ts [app/plugins/onboarding.ts]
export default defineNuxtPlugin(() => {
  const onboarded = useCookie<boolean>('onboarded')
  if (onboarded.value) {
    return
  }

  const unregister = addRouteMiddleware((to) => {
    if (to.path !== '/onboarding') {
      return navigateTo('/onboarding')
    }
  })

  watch(onboarded, (value) => {
    if (value) {
      unregister()
    }
  })
})
```

`onNuxtReady` accepts a `timeout`, so a callback can't be delayed for ever, and a `signal`, so a pending callback can be skipped if a component unmounts first ([#36743](https://github.com/nuxt/nuxt/pull/36743)):

```ts
const controller = new AbortController()
onNuxtReady(() => { /* ... */ }, { timeout: 2000, signal: controller.signal })
onBeforeUnmount(() => controller.abort())
```

And a few more:

- `sourcemap: { client: 'nosource' }` generates source maps without your original source code, so you can publish them safely (thanks to [@0xgdr](https://github.com/0xgdr), [#36534](https://github.com/nuxt/nuxt/pull/36534))
- `<NuxtLoadingIndicator>` has a `finish-color` prop (also [@0xgdr](https://github.com/0xgdr), [#36533](https://github.com/nuxt/nuxt/pull/36533))
- `navigateTo(url, { open })` can pass `noopener` by default, so the opened page can't reach back through `window.opener`. It's on with `compatibilityVersion: 5`, or set `experimental.defaults.navigateTo.noopener: true` ([#37075](https://github.com/nuxt/nuxt/pull/37075))
- `NuxtLinkSlotProps` is exported from `nuxt/app` (thanks to [@VividLemon](https://github.com/VividLemon), [#37092](https://github.com/nuxt/nuxt/pull/37092))
- `serverFetch` is typed against your server routes ([#36543](https://github.com/nuxt/nuxt/pull/36543))
- with Nitro v3, runtime config is a single object shared by every request, so in development Nuxt warns when it's mutated during server rendering (`NUXT_E1014`) ([#37076](https://github.com/nuxt/nuxt/pull/37076))
- when Node.js has to reparse your `nuxt.config` as ESM, Nuxt suggests adding `"type": "module"` to your `package.json` ([#37205](https://github.com/nuxt/nuxt/pull/37205))

## 🩹 Fixes

As always, there are a lot of fixes in this release. To name a few: [@pawell67](https://github.com/pawell67) made `callOnce` rerun after navigating away while it runs and stopped Nitro creating a request body stream until it's read ([#37149](https://github.com/nuxt/nuxt/pull/37149), [#37129](https://github.com/nuxt/nuxt/pull/37129)), [@astraldev](https://github.com/astraldev) made cookies set before a streamed response starts reach the browser and kept page loading going while a page is still pending ([#37131](https://github.com/nuxt/nuxt/pull/37131), [#37165](https://github.com/nuxt/nuxt/pull/37165)), [@waleedtariq109](https://github.com/waleedtariq109) made lazy hydration replay the interaction that triggered it ([#36838](https://github.com/nuxt/nuxt/pull/36838)), [@lafllamme](https://github.com/lafllamme) made a failed read of shared prerender data retry on later routes instead of prerendering them with `null` ([#37244](https://github.com/nuxt/nuxt/pull/37244)), and [@posva](https://github.com/posva) kept the browser's restored scroll position on reload ([#36957](https://github.com/nuxt/nuxt/pull/36957)).

Other fixes cover `useAsyncData` edge cases (cancelling a request superseded by a cache hit, settling when aborted, not using static data for a watch-triggered refresh), `useCookie` and `useResponseHeader`, query encoding in middleware redirects, and directory boundaries when matching layer aliases and path prefixes.

## 🔒 Security

This release fixes four security issues. We recommend upgrading. The advisories linked below have the full details (and will be released later on 24 November).

- **Route rules on `_payload.json`** ([GHSA-jxc9-w3j6-pwp2](https://github.com/nuxt/nuxt/security/advisories/GHSA-jxc9-w3j6-pwp2), medium): you're affected if you use a wildcard `cache`, `swr` or `isr` route rule together with a more specific rule for a page, for example `cache: false` for an authenticated section, or `redirect`, `proxy` or `headers`. A request for the page's `_payload.json` could be matched by the wildcard rule only, so one user's page data could be cached and served to another.
- **Encoded slashes on catch-all routes** ([GHSA-vrh2-cfcx-c3fg](https://github.com/nuxt/nuxt/security/advisories/GHSA-vrh2-cfcx-c3fg), medium): an incomplete fix for [GHSA-f3x9-2chm-73c8](https://github.com/nuxt/nuxt/security/advisories/GHSA-f3x9-2chm-73c8). You're affected if you rely on route rules (such as `appMiddleware`) for a catch-all page like `pages/[...slug].vue`. A repeated or leading encoded slash in the path could bypass them.
- **Dev server runtime config** ([GHSA-h5xj-x893-p5f7](https://github.com/nuxt/nuxt/security/advisories/GHSA-h5xj-x893-p5f7), low, development only): you're affected if you run `nuxt dev` reachable from an untrusted network. Private runtime config could be read from earlier Nitro build output.

Thank you to [inanna-malick](https://github.com/inanna-malick), [stilwel](https://github.com/stilwel), [kanokwut](https://github.com/kanokwut), [onur-yuksekkaya](https://github.com/onur-yuksekkaya), [DicksonWu654](https://github.com/DicksonWu654) and [rexpository](https://github.com/rexpository) for reporting these responsibly. 💚

::important
If you use `cache`, `swr` or `isr` route rules on pages with user-specific data, purge any CDN or edge cache that may already hold a `_payload.json` after you upgrade.
::

## ⚠️ Heads-Up Before Upgrading

None of these should break your app, but they're worth knowing about:

- **Nuxt DevTools is no longer installed with Nuxt.** If you use it, add `@nuxt/devtools` to your `devDependencies` (or click the button `nuxt dev` shows you).
- **Nuxt warns when your app's `vue` is older than the version it needs** (`NUXT_B7042`). Nuxt 4.7 requires `vue` `^3.5.46`, and `npx nuxt upgrade --dedupe` updates it along with Nuxt.
- **Template diagnostics are on.** You may see new `NUXT_B4025` warnings for links to pages that don't exist. If a link points at a server route, a file in `public/` or another site, add the `external` prop.
- **With `experimental.viteEnvironmentApi`, the client and server build in parallel.** If a Vite plugin reads the client build output from the server build, set `experimental.parallelBuild: false`.
- **`globalThis.$fetch` is only installed on the client when something uses it.** If you read it in a way Nuxt can't see at build time (from the browser console, an inline script or a file in `public/`), set `experimental.globalFetch: true`.
- **`@nuxt/rspack-builder` is deprecated** in favour of `@nuxt/rsbuild-builder`.
- **`<NuxtClientFallback>` is deprecated** in favour of `<NuxtErrorBoundary retry-on-client>`.

## ⬆️ Upgrading

Our recommendation for upgrading is to run:

```sh
npx nuxt upgrade --dedupe
```

This will refresh your lockfile and pull in the latest dependencies Nuxt relies on, including Nuxt CLI 4.1, `my-bad` v1 and `vite-plugin-checker` v1.

If you'd like to try Nitro v3, read [Testing Nitro v3](https://nuxt.com/docs/getting-started/upgrade#testing-nitro-v3) in the upgrade guide first.

## 👉 Full Release Notes

::read-more{icon="i-simple-icons-github" target="_blank" to="https://github.com/nuxt/nuxt/releases/tag/v4.7.0"}
Read the full release notes of Nuxt `v4.7.0`.
::

Thank you to everyone who contributed to this release, and especially to the 19 people who made their first contribution. 💚


## Sitemap

See the full [sitemap](https://nuxt.com/sitemap.md) for all pages.
