vite-plugin-vue-inspector
vite-plugin-vue-inspector
Jump from a Vue element in the browser to its source file in your editor.
This package is Vue 3 and Vite only. It records source locations from Vue's compiled render output with Vite source maps, so it no longer injects visible data-v-inspector attributes into the DOM. The browser overlay is drawn by client/overlay with DOM/SVG APIs instead of a Vue SFC. It can also register itself as a Vite DevTools dock action through @vitejs/devtools-kit.
Install
pnpm add -D vite-plugin-vue-inspector
Vite
import Vue from '@vitejs/plugin-vue'
import Inspector from 'vite-plugin-vue-inspector'
import { defineConfig } from 'vite'
export default defineConfig({
plugins: [Vue(), Inspector()],
})
Press Command+Shift on macOS or Ctrl+Shift on Windows/Linux to toggle the inspector. Click a highlighted element to open the source location in your editor.
Nuxt
Use the Vite plugin directly and append the client loader to Nuxt's entry module:
import Inspector from 'vite-plugin-vue-inspector'
import { defineNuxtConfig } from 'nuxt/config'
export default defineNuxtConfig({
vite: {
plugins: [
Inspector({
appendTo: /\/entry\.m?js$/,
}),
],
},
})
Vite DevTools
Vite DevTools integration is enabled by default:
Inspector({
viteDevtools: true,
})
When the dock action is activated, the inspector is enabled and editor opening goes through the Vite DevTools RPC.
Options
interface VitePluginInspectorOptions {
enabled?: boolean
toggleComboKey?: string | false
toggleButtonVisibility?: 'always' | 'active' | 'never'
toggleButtonPos?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left'
appendTo?: string | RegExp
lazyLoad?: number | false
disableInspectorOnEditorOpen?: boolean
launchEditor?: string
reduceMotion?: boolean
viteDevtools?: boolean
}
Client API
The overlay exposes a browser control object:
window.__VUE_INSPECTOR__?.enable()
window.__VUE_INSPECTOR__?.disable()
window.__VUE_INSPECTOR__?.toggleEnabled()
Headless helpers are also available:
import {
events,
findTraceAtPointer,
findTraceFromElement,
isEnabled,
} from 'vite-plugin-vue-inspector/client/listeners'
To use the built-in DOM overlay directly:
if (import.meta.hot) import('vite-plugin-vue-inspector/client/overlay')
Playgrounds
pnpm play:vue
pnpm play:nuxt
Related Packages
jump to local IDE source code while click the element of browser automatically.
Vue Inspector with enhanced features - supports end line and clipboard copy
jump to local IDE source code while click the element of browser automatically.
jump to local IDE source code while click the element of browser automatically.
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 7.0.0 | ^3.5.0 | MIT | |
| 6.0.0 | MIT | ||
| 5.4.0 | MIT | ||
| 5.3.2 | MIT | ||
| 5.3.1 | MIT | ||
| 5.3.0 | MIT | ||
| 5.2.0 | MIT | ||
| 5.1.3 | MIT | ||
| 5.1.2 | MIT | ||
| 5.1.1 | MIT | ||
| 5.1.0 | MIT | ||
| 5.0.1 | MIT | ||
| 5.0.0 | MIT | ||
| 4.0.2 | MIT | ||
| 4.0.1 | MIT | ||
| 4.0.0 | MIT | ||
| 3.7.2 | MIT | ||
| 3.7.1 | MIT | ||
| 3.7.0 | MIT | ||
| 3.6.0 | MIT | ||
| 3.5.0 | MIT | ||
| 3.4.2 | MIT | ||
| 3.4.1 | MIT | ||
| 3.4.0 | MIT | ||
| 3.3.2 | MIT | ||
| 3.3.1 | MIT | ||
| 3.3.0 | MIT | ||
| 3.2.2 | MIT | ||
| 3.2.1 | MIT | ||
| 3.2.0 | MIT |
Showing the latest 30 of 83. See every release on npm
Pre-releases (1)
| Version | Released | License |
|---|---|---|
| 3.0.0-beta.0 | MIT |