Skip to content

chore: migrate RPC to Vite DevTools Kit's RPC layer#957

Draft
antfu wants to merge 3 commits intomainfrom
antfu/migrate-rpc-vite-devtools
Draft

chore: migrate RPC to Vite DevTools Kit's RPC layer#957
antfu wants to merge 3 commits intomainfrom
antfu/migrate-rpc-vite-devtools

Conversation

@antfu
Copy link
Member

@antfu antfu commented Mar 18, 2026

Summary

  • Replace direct birpc usage with @vitejs/devtools-kit's RpcFunctionsHost for unified RPC transport
  • Maintain backward compatibility for existing Nuxt modules using extendServerRpc() through compatibility proxies
  • Move server RPC registration into Vite DevTools plugin setup callback

Changes

  • Server: Use RpcFunctionsHost.register() instead of createBirpcGroup with custom Vite HMR transport
  • Client: Replace birpc+HMR with getDevToolsRpcClient() from devtools-kit
  • Add compatibility broadcast/functions proxies for seamless module integration (vite-inspect, vscode, etc.)
  • Remove unused WS_EVENT_NAME constant and direct birpc dependencies

🤖 Generated with Claude Code

Replace direct birpc usage with @vitejs/devtools-kit's RpcFunctionsHost for unified RPC transport. Maintain backward compatibility for existing Nuxt modules using extendServerRpc() through compatibility proxies.

- Move server RPC registration into Vite DevTools plugin setup callback
- Use RpcFunctionsHost.register() instead of createBirpcGroup
- Replace client-side birpc+HMR with getDevToolsRpcClient() from devtools-kit
- Add compatibility broadcast/functions proxies for seamless module integration
- Remove unused WS_EVENT_NAME constant and direct birpc dependencies

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Mar 18, 2026

Deploying nuxt-devtools with  Cloudflare Pages  Cloudflare Pages

Latest commit: d435ec7
Status: ✅  Deploy successful!
Preview URL: https://77b31992.nuxt-devtools.pages.dev
Branch Preview URL: https://antfu-migrate-rpc-vite-devto.nuxt-devtools.pages.dev

View logs

…vTools

- Queue RPC broadcasts before host connects instead of dropping them
- Remove Nuxt DevTools auth system (now handled by Vite DevTools)
- Keep auth APIs as deprecated noops with runtime warnings for backward compat
- Fix RPC return types to use AsyncServerFunctions for correct type inference

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
functions: ServerFunctions,
nuxt = useNuxt(),
): BirpcGroup<ClientFunctions, ServerFunctions> {
): { broadcast: ClientFunctions } {
Copy link
Member

Choose a reason for hiding this comment

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

wouldn't that be a breaking change ?

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