Vite Plugin Vue DevTools
vite-plugin-vue-devtools is an official Vite plugin designed to integrate Vue DevTools directly into a development server, significantly enhancing the developer experience for Vue.js applications. It provides real-time inspection of component hierarchies, state management, routing, and performance metrics, all accessible within the browser's developer tools. The current stable version is 8.1.1, and the project exhibits an active release cadence with frequent updates for bug fixes and feature enhancements, indicating strong ongoing support from the Vue.js core team. Its key differentiator lies in its seamless, officially supported integration within the Vue ecosystem, offering a robust and consistent debugging environment for projects powered by Vite.
Common errors
-
Error: [vite-plugin-vue-devtools] The plugin function must return a plugin object.
cause The `VueDevTools` function was imported but not called as a function (e.g., `VueDevTools` instead of `VueDevTools()`) in the `plugins` array.fixCall the plugin function in your `vite.config.ts`: ```typescript plugins: [ VueDevTools(), // Corrected: call the function vue(), ], ``` -
Error: Cannot find module 'vite-plugin-vue-devtools'
cause The package was not installed, or the import path is incorrect, or an ESM-only package is being imported in a CommonJS context.fixEnsure the package is installed as a dev dependency: `npm install -D vite-plugin-vue-devtools` or `yarn add -D vite-plugin-vue-devtools`. Verify the import statement `import VueDevTools from 'vite-plugin-vue-devtools'` is correct in your `vite.config.ts`. -
Vue DevTools (vite plugin) doesn't render as expected
cause Often related to conflicts with other Vite plugins, particularly those that manipulate HTML, or incorrect plugin order.fixIf you are using `vite-plugin-html`, ensure `vite-plugin-vue-devtools` is registered before `vite-plugin-html` in your `vite.config.ts`. Also, check the official troubleshooting guide. -
Plugin fails when remote bindings are enabled (e.g., Cloudflare Workers D1)
cause There can be compatibility issues with `vite-plugin-vue-devtools` when specific build configurations, like remote bindings for databases (e.g., Cloudflare D1), are enabled, potentially due to how the plugin interacts with the HMR system.fixThis is a known issue (e.g., Cloudflare Workers issue #11063). A temporary workaround might be to disable `vite-plugin-vue-devtools` during development with such configurations, or monitor the respective GitHub issues for updates and patches.
Warnings
- breaking Vue DevTools v7+ (and thus `vite-plugin-vue-devtools` v7+) exclusively supports Vue 3 applications. Projects using Vue 2 must use older versions of Vue DevTools (v6).
- gotcha Multiple `vite-plugin-vue-devtools` versions (v7.7.8, v7.7.9, v8.0.3, v8.0.4) addressed compatibility issues with Node.js v25+. Older versions might encounter problems when running on newer Node.js environments.
- breaking Version 8.0.2 included a security fix that removed a vulnerable, unmaintained `ip` package dependency. Users on older versions might be exposed to potential security vulnerabilities.
- gotcha When combining `vite-plugin-vue-devtools` with other Vite plugins that modify HTML, such as `vite-plugin-html`, the order of plugins can matter. Incorrect ordering may prevent DevTools from rendering as expected.
- breaking The plugin has a peer dependency on `vite` (currently `^6.0.0 || ^7.0.0 || ^8.0.0`). Incompatible Vite versions will lead to installation or runtime errors.
Install
-
npm install vite-plugin-vue-devtools -
yarn add vite-plugin-vue-devtools -
pnpm add vite-plugin-vue-devtools
Imports
- VueDevTools
import { VueDevTools } from 'vite-plugin-vue-devtools'import VueDevTools from 'vite-plugin-vue-devtools'
- defineConfig
const defineConfig = require('vite')import { defineConfig } from 'vite' - VueDevTools options
import VueDevTools from 'vite-plugin-vue-devtools'; export default defineConfig({ plugins: [ VueDevTools({ componentInspector: false // Example option }), ], })
Quickstart
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import VueDevTools from 'vite-plugin-vue-devtools'
export default defineConfig({
plugins: [
vue(),
VueDevTools(),
],
// Ensure your Vite project is configured for Vue 3
// For example, if using TypeScript, ensure 'vue' is correctly resolved
// Example of an environment variable usage (if applicable for other plugins):
// server: {
// port: parseInt(process.env.PORT ?? '5173')
// }
})