devtools-vite-plugin

Configure the TanStack Devtools Vite plugin for source inspection, console piping, and production stripping.

1.4k|34|Updated Mar 7, 2024
One-click install
npx skills add https://github.com/mehdibha/dotUI --skill devtools-vite-plugin-mehdibha
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: devtools-vite-plugin
Source: https://github.com/mehdibha/dotUI/tree/main/.claude/skills/tanstack-devtools-vite-plugin
Command: npx skills add https://github.com/mehdibha/dotUI --skill devtools-vite-plugin-mehdibha

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @tanstack/devtools-vite.

What problem does it solve? Setting up @tanstack/devtools-vite involves many interacting sub-plugins, and misconfiguration (wrong plugin order, unsupported bundlers, spread-props components) causes silent failures that are hard to diagnose. ## Core Features & Use Cases - Source Inspection Setup: Configure data-tsd-source injection, inspect hotkeys, and ignore patterns so clicking a component in the browser opens its source in your editor. - Console Piping & Enhanced Logging: Pipe client and server console output bidirectionally with source-location annotations on log calls. - Production Stripping & Event Bus: Remove devtools code from production builds and configure the WebSocket/SSE event bus port, host, and HTTPS behavior. - Use Case: You are adding TanStack Devtools to a Vite + React project and need the plugin placed first in the config, source inspection working, and devtools stripped from production builds. ## Quick Start Configure the TanStack devtools Vite plugin in my vite.config.ts with source inspection and console piping enabled.

Frequently Asked Questions about devtools-vite-plugin

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up @tanstack/devtools-vite in my Vite config?▼

Install it as a dev dependency and call devtools() as the first entry in the Vite plugins array. All its sub-plugins use enforce: 'pre', so they must run before framework plugins like react() to transform raw JSX.

Why must the TanStack devtools plugin be first in the Vite plugins array?▼

Every sub-plugin uses enforce: 'pre' and must transform code before framework plugins process it. If devtools comes after react(), source injection and enhanced logs silently fail because the raw JSX is already transformed.

Does @tanstack/devtools-vite work with webpack or rspack?▼

No. It has a peer dependency on vite ^6.0.0 || ^7.0.0 and uses Vite-specific APIs like configureServer and transform filters. For other bundlers, use @tanstack/devtools-event-bus client directly without the Vite plugin.

Why is source inspection not working for some components?▼

The inject-source transform skips JSX elements that spread the component's props parameter, since the spread would overwrite the injected data-tsd-source attribute. It also skips files and components matching your injectSource.ignore patterns.

Do TanStack devtools features work in production builds?▼

No. Source inspection, console piping, enhanced logging, and the event bus only run in dev mode with the serve command. In production, only the remove-devtools-on-build sub-plugin is active, stripping devtools imports and JSX from the bundle.

How do I fix event bus port conflicts when running multiple Vite dev servers?▼

The default port 4206 causes EADDRINUSE on the second server, which falls back to an OS-assigned port automatically. For predictable ports, set eventBusConfig.port explicitly per project, such as 4206 and 4207.