Skip to content

feat(devtools): proxy client __connection.json to hub in standalone dev - #1070

Merged
antfu merged 1 commit into
mainfrom
wise-rockets-spend
Aug 21, 2026
Merged

feat(devtools): proxy client __connection.json to hub in standalone dev#1070
antfu merged 1 commit into
mainfrom
wise-rockets-spend

Conversation

@antfubot

Copy link
Copy Markdown
Collaborator

Intent

When developing the DevTools client standalone via pnpm dev (nuxi dev client), the client SPA at base /__nuxt_devtools__/client/ couldn't connect to a live RPC backend.

The app dogfoods the DevTools module on itself, so the Vite DevTools hub serves the devframe connection meta at its mount path /__devtools/__connection.json. However, the client's RPC client resolves __connection.jsonrelative to its current route (e.g. after redirecting to /modules/overview it fetches /__nuxt_devtools__/client/modules/__connection.json), which the hub never serves — so the standalone client's connection attempt 404s.

This adds a dev-server-only Vite proxy that rewrites any __connection.json lookup under the client base back to the hub's /__devtools/__connection.json, letting the standalone client connect to a live RPC backend.

Scoped to local dev only: server.proxy is a Vite dev-server feature and never applies to static nuxi generate output. The proxy target honors process.env.PORT to stay consistent with the existing hmr.clientPort logic.

This PR was created with the help of an agent.

When running the DevTools client standalone (`pnpm dev` -> `nuxi dev client`),
the SPA resolves the devframe connection meta relative to its current route,
which the dogfooded Vite DevTools hub never serves. Proxy those lookups back
to the hub so the standalone client can connect to a live RPC backend.
@coderabbitai

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ba66f203-da64-4d41-ab75-ed7de0177879

📥 Commits

Reviewing files that changed from the base of the PR and between a241951 and 9114445.

📒 Files selected for processing (1)
  • packages/devtools/client/nuxt.config.ts

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

Added a Vite development-server proxy in the Nuxt DevTools client configuration. The proxy forwards relative __connection.json requests to the local DevTools hub on the configured PORT or port 3000. It enables origin changes and rewrites the request path to /__devtools/__connection.json.

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

Merge Risk:⚪ Minimal · up to 91144

This is a localized development-only proxy change for standalone DevTools connectivity, with no actionable merge-blocking risk remaining beyond normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check nameStatusExplanation
Title check✅ PassedThe title clearly and concisely describes the main change: proxying client connection requests to the DevTools hub during standalone development.
Description check✅ PassedThe description explains the standalone client connection failure, the proxy fix, its development-only scope, and the port behavior.
Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch wise-rockets-spend

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.

@antfu
antfu merged commit 4449f09 into mainAug 21, 2026
5 of 6 checks passed
@antfu
antfu deleted the wise-rockets-spend branch August 21, 2026 04:27
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.

2 participants

@antfubot@antfu