Vite plugin that wraps the Vue Docgen API to generate metadata (props, events, slots, methods, etc.) from Vue single-file components (SFC). Current stable version is 0.3.4. It injects docgen information as a property on the component at build time. Simple configuration with include/exclude patterns and custom property name. Requires Vite >2.0. Provides TypeScript types. Lightweight alternative to vue-styleguidist's webpack plugin for Vite users.
npm install vite-plugin-vue-docgenNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Vite config setup with vue plugin and docgen plugin, then accessing __docgenInfo on a Vue SFC component.
Ensure order: vue() then vueDocgen() in plugins array.
Use default import: import vueDocgenPlugin from 'vite-plugin-vue-docgen'
Add 'moduleResolution': 'node' in tsconfig.json or use Vite's default.
Use Vite 3+ if possible.
Test in both dev and build modes, especially when using jsx:true and custom resolvers.
Use explicit defineExpose or defineOptions if needed; consider using 'vue-docgen-cli' for more comprehensive output.
Use ESM import: import vueDocgenPlugin from 'vite-plugin-vue-docgen'
Install via npm: npm install vite-plugin-vue-docgen --save-dev
Ensure the component is imported statically and the plugin is correctly configured in vite.config
Add a declaration file: declare module '*.vue' { const component: any; export default component; } or use vue-docgen-api types.