Skip to content

chore(deps): update nuxt to 4.5.1 and vite to 8 - #649

Merged
kelsos merged 3 commits into
rotki:mainfrom
kelsos:chore/nuxt-vite
Aug 4, 2026
Merged

chore(deps): update nuxt to 4.5.1 and vite to 8#649
kelsos merged 3 commits into
rotki:mainfrom
kelsos:chore/nuxt-vite

Conversation

@kelsos

@kelsos kelsos commented Aug 4, 2026

Copy link
Copy Markdown
Member

Batch 4 of the renovate dashboard (#169): the coupled Nuxt + Vite upgrade.

Package From To
nuxt 4.4.7 4.5.1
vite 7.3.5 8.1.5 (Rolldown)
vite-plugin-vue-devtools 8.1.2 8.2.1

They genuinely are coupled: @nuxt/vite-builder@4.5.1 depends on vite ^8.1.5, so Nuxt 4.5 cannot be taken without Vite 8.

nitropack, vite-ssg, @vitejs/plugin-vue and @nuxt/devtools are already on their newest releases and are unchanged here.

The interesting part: a Rolldown miscompilation

Vite 8 broke the build. nuxi generate aborted with a bare [500] Server Error on /sponsor/mint and nothing else, no stack. The underlying error turned out to be ReferenceError: ref is not defined, raised in useRotkiSponsorshipPayment.

The cause is ours, and it is worth knowing about. use-payment.ts had a ContractRef parameter and a local both named ref, shadowing the ref auto-imported from vue. Rolldown spots the inner bindings, renames the imported one to ref$1 to dodge the collision, and then fails to rewrite two call sites in the enclosing scope:

import { ref as ref$1, computed, shallowRef, ... } from "vue"
...
const sponsorshipState = ref({ status: "idle" });   // bare `ref`, no binding in scope
const error = ref();

11 of the 13 call sites were rewritten to ref$1; two were not. Under Vite 7 / rollup the import was never renamed, so the shadowing was harmless and this stayed latent.

The fix is in a separate commit and does not depend on the bundler being wrong: shadowing ref is something the code should not have been doing. Locals are renamed to contractRef and referral. I swept the whole workspace for locals shadowing vue auto-imports (ref, computed, watch, shallowRef, reactive, …) and these five sites were the only ones:

  • app/modules/web3/sponsorship/use-payment.ts (the one that broke)
  • app/modules/web3/sponsorship/actions.ts (two params)
  • app/components/products/ProductsButtons.vue
  • app/modules/checkout/components/method/PaymentMethodSelection.vue
  • tests/unit/modules/web3/client.spec.ts

unhead now doubles up

Nuxt 4.5 moves its own unhead dependency from ^2.1.15 to ^3.1.8, so the tree carries @unhead/vue 2.1.15 (catalog, used by packages/card-payment) and 3.2.3 (via nuxt) side by side. That is expected rather than a mistake: card-payment is a separate vite-ssg app, not Nuxt, and unhead 3 is still a held-back major for it. Worth folding into the eventual unhead 3 batch.

Also here

.nuxtrc is a tracked file that @nuxt/test-utils rewrites on install. The 4.0.3 → 4.1.0 bump landed in #648 but the regenerated file was not committed with it, so it is picked up here in its own commit.

Verification

  • typecheck clean, lint clean (68 pre-existing warnings, 0 errors), 476 tests pass.
  • generate builds 181 pages and 155 OG images, sitemap still 170 URLs. /sponsor/mint now prerenders to real markup (72 KB) with no error payload in it.
  • packages/card-payment builds clean on Vite 8 with vite-ssg 28.3.0.

@kelsos
kelsos requested a review from a team as a code owner August 4, 2026 12:31
@codecov-commenter

codecov-commenter commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 27.92%. Comparing base (98529a5) to head (7cdec8e).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...ebsite/app/modules/web3/sponsorship/use-payment.ts 0.00% 5 Missing ⚠️
...ckout/components/method/PaymentMethodSelection.vue 0.00% 3 Missing ⚠️
...ebsite/app/components/products/ProductsButtons.vue 0.00% 2 Missing ⚠️
...es/website/app/modules/web3/sponsorship/actions.ts 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #649      +/-   ##
==========================================
- Coverage   28.33%   27.92%   -0.42%     
==========================================
  Files         391      391              
  Lines       12276    12457     +181     
  Branches     1977     1945      -32     
==========================================
  Hits         3478     3478              
- Misses       8699     8880     +181     
  Partials       99       99              
Flag Coverage Δ
backend 56.55% <ø> (ø)
frontend 18.72% <0.00%> (-0.37%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

kelsos added 3 commits August 4, 2026 14:33
`use-payment.ts` named a ContractRef parameter and a local `ref`, which
shadows the auto-imported `ref` from vue. Two other files did the same with
a referral code, and `actions.ts` with two more ContractRef parameters.

This was latent under vite 7 but breaks under vite 8. Rolldown sees the
inner `ref` bindings, renames the imported one to `ref$1` to avoid the
collision, and then fails to rewrite two call sites in the enclosing scope:

    import { ref as ref$1, computed, shallowRef, ... } from "vue"
    ...
    const sponsorshipState = ref({ status: "idle" });   // never defined

At render time that is a ReferenceError, so /sponsor/mint returned a 500 and
`nuxi generate` aborted on it.

Renaming ours to `contractRef` and `referral` removes the collision, and is
what the code should have said in the first place. Swept the whole workspace
for locals shadowing vue auto-imports; these five were the only ones.
@nuxt/test-utils rewrites this tracked file on install. The 4.0.3 -> 4.1.0
bump landed in the patch sweep but the regenerated file was not committed
with it.
- nuxt 4.4.7 -> 4.5.1
- vite 7.3.5 -> 8.1.5 (Rolldown)
- vite-plugin-vue-devtools 8.1.2 -> 8.2.1

These are coupled: @nuxt/vite-builder@4.5.1 depends on vite ^8.1.5, so nuxt
4.5 cannot be taken without vite 8.

nitropack, vite-ssg, @vitejs/plugin-vue and @nuxt/devtools are already on
their newest releases and are unchanged. vite-ssg 28.3.0 accepts vite
^8.0.0-0, and packages/card-payment, the only consumer, builds clean.

Nuxt 4.5 moves its own unhead dependency from ^2.1.15 to ^3.1.8, so the tree
now carries @unhead/vue 2.1.15 (catalog, used by packages/card-payment) and
3.2.3 (via nuxt) side by side. That is expected: card-payment is a separate
vite-ssg app, not Nuxt, and unhead 3 is still a held-back major for it.

Needed the ref-shadowing fix in the preceding commit to build at all.
@kelsos

kelsos commented Aug 4, 2026

Copy link
Copy Markdown
Member Author

On the duplicated unhead, for the record: this cannot be collapsed today. vite-ssg@28.3.0 (newest release) depends on @unhead/vue: ^2.1.2 as a direct dependency, not a peer, so no vite-ssg version accepts unhead 3.

Moving the catalog to 3 would also be actively wrong rather than merely useless: card-payment's useHead has to come from the same unhead instance vite-ssg installs, since vite-ssg provides the head via Vue's app context. A different copy means a different injection key and the head tags silently stop being emitted.

Verified the current state is working: card-payment resolves @unhead/vue 2.1.15 and its built index.html still carries the injected <title>Pay with Card - rotki</title> plus the meta tags. So the two copies are correct, and it collapses on its own once vite-ssg supports unhead 3.

@kelsos
kelsos merged commit 7cdec8e into rotki:main Aug 4, 2026
9 checks passed
@kelsos
kelsos deleted the chore/nuxt-vite branch August 4, 2026 12:53
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.

2 participants