Skip to content

fix(deps): upgrade nuxt to 4.7 with matching nitro and unhead - #705

Merged
TheMeinerLP merged 2 commits into
mainfrom
fix/nuxt-4-7-upgrade
Nov 28, 2026
Merged

TheMeinerLP merged 2 commits into
mainfrom
fix/nuxt-4-7-upgrade

Conversation

@TheMeinerLP

Copy link
Copy Markdown
Collaborator

Summary

The Renovate bumps for Nuxt 4.7 (#696), @unhead/vue 3.5.2 (#672) and the lock file maintenance (#613) all failed the production build, so none of them could merge. This PR does the upgrade as one coherent change, so those three become unnecessary.

Why the bumps broke

What else moving to Nitro v3 needed

  • lru-cache is added: Nitro 3 resolves the og-image runtime cache driver from the app and tried to install it itself.
  • The content dump routes are no longer prerendered, since the Nitro 3 prerenderer serves no public assets. The Worker serves the dumps from ASSETS at runtime, as before.
  • The three server plugins use Nitro's response hook instead of the legacy beforeResponse bridge. With the bridge, error pages came out indexable again (x-robots-tag: index); they are noindex, no-store now.
  • The server tsconfig is pointed at the @nuxt/content collection types, which Nitro v3 no longer picks up on its own.
  • The PersonLink spec runs in the nuxt environment, because NuxtLink now renders inline and ignores stubs.

Verification

  • pnpm build passes, pnpm quality shows no regression (186 / 17 / 3), pnpm test passes (2417 tests).
  • Checked on the preview build: security headers on pages and errors, noindex on 404, dump route served by the Worker.
  • The first request after a cold wrangler dev start can fail once while the content database initialises; the following ones succeed. Worth a look on the first deploy.

Supersedes #696, #672 and #613.

Nuxt 4.7 runs on Nitro v3 through @nuxt/nitro-v3-server, which needs the
nitro 3.0.261103-rc release and @unhead/vue 3.5 together with its unhead core.

- bump nuxt, nitro and @unhead/vue; add lru-cache, which Nitro 3 now
  resolves from the app for the og-image runtime cache
- skip prerendering the content dump routes: the Nitro 3 prerenderer
  serves no public assets, the Worker serves them from ASSETS at runtime
- point the server tsconfig at the @nuxt/content collection types
- move the three server plugins from the legacy beforeResponse hook to
  Nitro's response hook, which fixes error pages losing their noindex
- drop the ignored nitro externals option and an unused ts-expect-error
- test PersonLink in the nuxt environment, as NuxtLink now renders inline
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
launchpad f37d9d3 Commit Preview URL

Branch Preview URL
Nov 28 2026, 05:55 PM

@nuxt/content refills an empty D1 database through serverFetch. Nitro 3 runs
that as a fresh request without the cloudflare runtime context, so the dump
handler found no ASSETS binding and answered 404; the first render of a new
deploy then failed with a hung worker.

- add a server plugin that attaches env from cloudflare:workers to requests
- type the default $fetch cast of the content fetch adapter precisely
- reword the prerender ignore comment
@TheMeinerLP
TheMeinerLP merged commit 359a14c into main Nov 28, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant