Skip to content

fix(vite): subscribe rollup:reload to hot-reload after updateConfig - #4503

Merged
pi0 merged 2 commits into
mainfrom
fix/vite-dev-update-config
Jul 31, 2026
Merged

fix(vite): subscribe rollup:reload to hot-reload after updateConfig#4503
pi0 merged 2 commits into
mainfrom
fix/vite-dev-update-config

Conversation

@danielroe

Copy link
Copy Markdown
Member

🔗 Linked issue

❓ Type of change

  • 📖 Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

spotted in nuxt - calling updateConfig did nothing when using with nitro/vite.

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@danielroe
danielroe requested a review from pi0 as a code owner July 31, 2026 20:40
@vercel

vercel Bot commented Jul 31, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
nitro.build Ready Ready Preview Jul 31, 2026 8:49pm

Request Review

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The Vite development server now invokes its debounced reload workflow on Nitro rollup:reload events. A new integration test verifies that dynamic updateConfig({ routeRules }) changes update endpoint response headers.

Changes

Vite development reload updates

Layer / File(s) Summary
Nitro reload hook wiring
src/build/vite/dev.ts
Registers a rollup:reload hook that triggers the existing debounced reload workflow.
Dynamic route rule integration coverage
test/vite/update-config.test.ts
Starts a Vite server, checks the initial response, updates routeRules, and polls until the x-extend header appears.

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

Possibly related PRs

  • nitrojs/nitro#4387: Both changes modify the Vite development reload workflow, but use different hooks and behavior.
  • nitrojs/nitro#4411: Both changes address Vite/Nitro route-rule reload behavior and add related testing.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title follows Conventional Commits syntax and clearly describes the Vite hot-reload fix.
Description check ✅ Passed The description identifies the nitro/vite updateConfig bug and explains that the change enables hot reload.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/vite-dev-update-config

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.

@pkg-pr-new

pkg-pr-new Bot commented Jul 31, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/nitro@4503

commit: 6b17505

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

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

Inline comments:
In `@test/vite/update-config.test.ts`:
- Line 27: Restore the original process working directory after the test setup
that calls process.chdir(rootDir), ensuring cleanup runs after the affected
tests complete so later tests are not left resolving paths from the fixture
directory.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 65368265-b9c3-4233-a67c-52ae3a93f00f

📥 Commits

Reviewing files that changed from the base of the PR and between 77b77ff and 6b17505.

📒 Files selected for processing (2)
  • src/build/vite/dev.ts
  • test/vite/update-config.test.ts

Comment thread test/vite/update-config.test.ts Outdated
@pi0
pi0 merged commit 52abde8 into main Jul 31, 2026
10 of 11 checks passed
@pi0
pi0 deleted the fix/vite-dev-update-config branch July 31, 2026 20:48
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