Use the Vite plugin when the Vue app already builds through Vite. Use the CLI when you want an explicit local or CI command.
Install
Add Vite Doctor to the project:
pnpm add -D vite-doctor
Register the Vite plugin in vite.config.ts:
import vue from "@vitejs/plugin-vue";
import { doctor } from "vite-doctor";
import { defineConfig } from "vite";
export default defineConfig({
plugins: [vue(), doctor({ framework: "vue" })],
});
Run Doctor directly when you want a focused scan:
pnpm vite-doctor . --rules vue
Configure
Plugin options are the Vue project surface. Put rule policy close to the Vite config that owns the build:
import vue from "@vitejs/plugin-vue";
import { doctor } from "vite-doctor";
import { defineConfig } from "vite";
export default defineConfig({
plugins: [
vue(),
doctor({
framework: "vue",
extends: ["vue/recommended"],
config: {
rules: {
"vue/reactivity/no-ref-as-operand": "error",
},
},
}),
],
});
Presets
Doctor activates the Recommended Preset for Vue and Nuxt projects. It only includes Rules whose diagnostics point at a specific defect: lost reactivity, watcher and lifecycle leaks, SSR hydration mismatches, browser APIs on the server, and untrusted HTML.
The Strict Preset adds style, naming, and migration Rules, such as defineModel() and useTemplateRef() migrations, attribute shorthands, type-only props, the use prefix for composables, VueUse useEventListener(), reason comments on data-allow-mismatch, and vue-i18n checks for untranslated text and unused keys:
pnpm vite-doctor . --framework vue --extends auto,vue/strict
Pick the right reference
Vue rules focus on reactivity, template, watcher, lifecycle, SSR, and security mistakes in Vue code. Start in Vue rules when a diagnostic begins with vue/.
If the same project also has Vite runtime or build diagnostics, use Vite rules for vite/... diagnostics.
Fix a diagnostic
Open the rule page from the reported rule ID, compare the before/after example to your component, and re-run the same rule:
pnpm vite-doctor . --framework vue --rules vue/reactivity/no-ref-as-operand
Use --max-warnings 0 in CI when warnings should block a pull request.