Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/devtools/src/module-main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export async function enableModule(options: ModuleOptions, nuxt: Nuxt) {
connectDevToolsKit?.(ctx)
},
},
}))
}), { server: false })
addPlugin({
src: join(runtimeDir, 'plugins/vite-devtools.client'),
mode: 'client',
Expand Down
7 changes: 7 additions & 0 deletions packages/devtools/src/server-rpc/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,13 @@ export function setupRPC(nuxt: Nuxt, options: ModuleOptions) {
* Called from the Vite DevTools plugin setup callback.
*/
function connectDevToolsKit(ctx: DevToolsNodeContext) {
/**
* guarded to keep the first connection (client Vite), since Nuxt creates
* two Vite instances and the second (server) one has 0 WebSocket clients.
* If we don't guard this, the server connection will overwrite the client connection and break all RPC calls from server to client.
*/
if (devtoolsKitCtx)
return
devtoolsKitCtx = ctx
const host = ctx.rpc

Expand Down
Loading