{"id":22914,"library":"vite-plugin-vitepress-auto-sidebar","title":"vite-plugin-vitepress-auto-sidebar","description":"Vite plugin that automatically generates VitePress sidebar configuration by scanning the docs directory structure. Version 1.7.1 supports options like ignoreList, collapsed groups, title extraction from markdown files or frontmatter, and auto-updates on file changes. Active development with frequent releases. Differentiates by being a dedicated Vite plugin rather than a build-time script, with live HMR support for sidebar regeneration.","status":"active","version":"1.7.1","language":"javascript","source_language":"en","source_url":"https://github.com/QC2168/vite-plugin-vitepress-auto-sidebar","tags":["javascript","vitepress","vite","sidebar","auto-sidebar","typescript"],"install":[{"cmd":"npm install vite-plugin-vitepress-auto-sidebar","lang":"bash","label":"npm"},{"cmd":"yarn add vite-plugin-vitepress-auto-sidebar","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-plugin-vitepress-auto-sidebar","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency: plugin generates sidebar data for VitePress themeConfig.","package":"vitepress","optional":false},{"reason":"Peer dependency: requires Vite to function as a plugin.","package":"vite","optional":false}],"imports":[{"note":"ESM-only; CommonJS require will fail.","wrong":"const AutoSidebar = require('vite-plugin-vitepress-auto-sidebar')","symbol":"AutoSidebar","correct":"import AutoSidebar from 'vite-plugin-vitepress-auto-sidebar'"},{"note":"Package has a default export, not a named export.","wrong":"import { AutoSidebar } from 'vite-plugin-vitepress-auto-sidebar'","symbol":"AutoSidebar (default import)","correct":"import AutoSidebar from 'vite-plugin-vitepress-auto-sidebar'"},{"note":"TypeScript users can import the options interface for type checking.","wrong":"","symbol":"options type","correct":"import type { AutoSidebarOptions } from 'vite-plugin-vitepress-auto-sidebar'"}],"quickstart":{"code":"// .vitepress/config.ts\nimport { defineConfig } from 'vitepress'\nimport AutoSidebar from 'vite-plugin-vitepress-auto-sidebar'\n\nexport default defineConfig({\n  vite: {\n    plugins: [\n      AutoSidebar({\n        path: '/docs',\n        ignoreList: ['public'],\n        collapsed: false,\n        ignoreIndexItem: true,\n        titleFromFile: true,\n        titleFromFileByYaml: true,\n        scanRootMdFiles: true,\n        deletePrefix: ''\n      })\n    ]\n  },\n  title: 'My Docs',\n  description: 'Documentation site'\n})","lang":"typescript","description":"Configure the plugin in VitePress config to auto-generate sidebar from /docs structure."},"warnings":[{"fix":"Remove the `sidebar` property from `themeConfig` in your config file.","message":"You must clear the existing sidebar object in your VitePress config or the plugin may not work properly.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Set `ignoreIndexItem: true` in plugin options.","message":"The `ignoreIndexItem` option's default is `false`; if you have `index.md` files, they will appear as sidebar items unless set to `true`.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use only `titleFromFile` if you want markdown-level heading; use `titleFromFileByYaml` for frontmatter. They are not mutually exclusive.","message":"The option `titleFromFileByYaml` may conflict with `titleFromFile`; if both true, frontmatter title takes precedence.","severity":"deprecated","affected_versions":">=1.3.0"},{"fix":"Ensure the directory specified in `path` exists relative to project root.","message":"If `path` does not exist, the plugin silently fails without error. Sidebar data will not be injected.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Restart the dev server or trigger a production rebuild after file changes.","message":"File changes (add/delete .md) are watched only in dev mode; manual rebuild needed in production.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"No action needed.","cause":"Plugin is working correctly; no error.","error":"[auto-sidebar] injected sidebar data successfully"},{"fix":"Run `npm install vite-plugin-vitepress-auto-sidebar` and ensure import is correct.","cause":"Package not installed or incorrect import path.","error":"Cannot find module 'vite-plugin-vitepress-auto-sidebar'"},{"fix":"Change `import { AutoSidebar }` to `import AutoSidebar`.","cause":"Using named import instead of default import.","error":"AutoSidebar is not a function"},{"fix":"Add themeConfig with empty sidebar or remove the sidebar property.","cause":"VitePress config missing or sidebar property not cleared.","error":"TypeError: Cannot read properties of undefined (reading 'sidebar')"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}