Skip to content

fix: correctly report Vite version when using Vite+ - #1415

Merged
danielroe merged 1 commit into
nuxt:mainfrom
Norbiros:fix/properly-detect-vite-version-in-vp
Jul 31, 2026
Merged

fix: correctly report Vite version when using Vite+#1415
danielroe merged 1 commit into
nuxt:mainfrom
Norbiros:fix/properly-detect-vite-version-in-vp

Conversation

@Norbiros

Copy link
Copy Markdown
Contributor

🔗 Linked issue

📚 Description

Before:

image

After:

image

@Norbiros
Norbiros requested a review from danielroe as a code ownerJuly 31, 2026 15:08
@pkg-pr-new

Copy link
Copy Markdown
  • nuxt-cli-playground

    npm i https://pkg.pr.new/create-nuxt@1415
    
    npm i https://pkg.pr.new/nuxi@1415
    
    npm i https://pkg.pr.new/@nuxt/cli@1415
    

commit: b82db83

@coderabbitai

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

getBuilder now detects Vite+ and returns its provider name and version with the bundled Vite version. showBanner displays this provider information when available. Unit tests cover provider detection and banner output.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check nameStatusExplanation
Title check✅ PassedThe title clearly states the Vite version reporting fix for Vite+, which matches the main code and test changes.
Description check✅ PassedThe description explains the Vite+ version reporting issue and shows the corrected Nuxt CLI output, so it relates directly to the changes.
Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
packages/nuxt-cli/test/unit/utils/banner.spec.ts (1)

21-23: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Restrict the Vite+ mock to the intended lookup.

Line 21 checks only _cwd. Any getPkgJSON call under /vite-plus receives Vite+ metadata, even when it requests another package or uses another via path. This can make unrelated tests pass with incorrect package data. Check pkg === 'vite' and options?.via?.includes('@nuxt/vite-builder') before returning this object.

Proposed fix
- if (_cwd === '/vite-plus') {+ if (_cwd === '/vite-plus'+ && pkg === 'vite'+ && options?.via?.includes('`@nuxt/vite-builder`')) {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/nuxt-cli/test/unit/utils/banner.spec.ts` around lines 21 - 23,
Update the condition in the getPkgJSON mock at the vite-plus path check to be
more restrictive. The if statement checking _cwd === '/vite-plus' should also
validate that pkg === 'vite' and that options?.via includes '`@nuxt/vite-builder`'
before returning the Vite+ metadata object. This ensures the mock only applies
to the intended lookup and prevents unrelated tests from receiving incorrect
package data.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@packages/nuxt-cli/test/unit/utils/banner.spec.ts`:
- Around line 21-23: Update the condition in the getPkgJSON mock at the
vite-plus path check to be more restrictive. The if statement checking _cwd ===
'/vite-plus' should also validate that pkg === 'vite' and that options?.via
includes '`@nuxt/vite-builder`' before returning the Vite+ metadata object. This
ensures the mock only applies to the intended lookup and prevents unrelated
tests from receiving incorrect package data.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ae32f527-ad59-4e6a-80a8-0cbcb466f358

📥 Commits

Reviewing files that changed from the base of the PR and between 810231e and b82db83.

📒 Files selected for processing (2)
  • packages/nuxt-cli/src/utils/banner.ts
  • packages/nuxt-cli/test/unit/utils/banner.spec.ts

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@810231e). Learn more about missing BASE report.

Additional details and impacted files
@@ Coverage Diff @@## main #1415 +/- ##
=======================================
Coverage ? 62.21% =======================================
Files ? 96 Lines ? 4777 Branches ? 1466 =======================================
Hits ? 2972 Misses ? 1459 Partials ? 346 

☔ 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.

@codspeed-hq

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 2 untouched benchmarks


Comparing Norbiros:fix/properly-detect-vite-version-in-vp (b82db83) with main (810231e)

Open in CodSpeed

@danielroe
danielroe merged commit 256346c into nuxt:mainJul 31, 2026
16 checks passed
@github-actionsgithub-actionsBot mentioned this pull request Jul 31, 2026
@Norbiros
Norbiros deleted the fix/properly-detect-vite-version-in-vp branch August 1, 2026 05:45
This was referenced Aug 24, 2026
Sign up for freeto 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.

4 participants

@Norbiros@codecov-commenter@danielroe@gameroman