Skip to main content

Frequently Asked Questions

Answers to common questions about VitePress.

General Questions

VitePress is a Vue-powered static site generator built on top of Vite. It’s a spiritual successor to VuePress, designed specifically for creating fast, modern documentation sites.Key Features:
  • Lightning-fast development with Vite
  • Vue 3 components in markdown
  • Optimized static site generation
  • Beautiful default theme
  • Powerful theming capabilities
VitePress advantages:
  • Much faster development and build times (powered by Vite)
  • Simpler, more streamlined architecture
  • Better performance out of the box
  • Modern Vue 3 and Composition API
  • Lighter weight and fewer dependencies
When to use VuePress:
  • Need plugin ecosystem from VuePress v1
  • Require backward compatibility
  • Using VuePress-specific plugins
VitePress is recommended for new projects.
Yes! VitePress is used in production by many major projects:
  • Vue.js official documentation
  • Vite documentation
  • Vitest documentation
  • Rollup documentation
  • Many other open source projects
Note: Version 2.0 is currently in alpha. For production use, consider using v1.x (stable) or test v2.x alpha thoroughly.
Yes, but it requires some manual work:
  1. Config format changes: VitePress uses a different config structure
  2. Markdown plugins: Some VuePress plugins need replacement
  3. Theme customization: Different theming approach
  4. Components: May need to update Vue 2 to Vue 3 syntax
Benefits often outweigh migration effort:
  • Significantly faster build times
  • Better developer experience
  • Modern architecture
  • Active development

Installation & Setup

Minimum Requirements:
  • Node.js v20 or higher
  • pnpm, npm, or yarn package manager
Recommended:
  • Node.js v20+ (latest LTS)
  • pnpm for faster installs
  • 4GB+ RAM for large sites
  • SSD storage for better performance
Use the initialization wizard:
Or manually:
pnpm is recommended but not required:Advantages:
  • Faster installation (hard links instead of copying)
  • Better disk space efficiency
  • Stricter dependency resolution
  • Used by VitePress development team
You can still use:
  • npm (works fine, just slower)
  • yarn (also supported)
Choose based on your project needs.

Configuration

Create .vitepress/config.ts (or .js, .mts, .mjs) in your docs directory:
TypeScript (recommended):
JavaScript:
Add to your config file:
Yes! VitePress supports environment variables:
.env file:
Load with dotenv:

Customization

Option 1: Extend default themeCreate .vitepress/theme/index.ts:
Option 2: CSS variablesCreate .vitepress/theme/custom.css:
Option 3: Complete custom themeCreate your own theme from scratch (advanced).
Yes! VitePress supports Vue components directly in markdown:1. Create component .vitepress/theme/components/MyComponent.vue:
2. Register globally .vitepress/theme/index.ts:
3. Use in markdown:
Add to all pages via config:
Theme-level CSS:Create .vitepress/theme/custom.css and import in .vitepress/theme/index.ts.Per-page via frontmatter:

Content & Markdown

VitePress supports:Standard Markdown:
  • Headers, lists, links, images
  • Code blocks with syntax highlighting
  • Tables, blockquotes
  • Emphasis (bold, italic)
Extended Features:
  • GitHub-flavored alerts (Note, Warning, etc.)
  • Code groups and line highlighting
  • File imports and snippets
  • Custom containers
  • Emoji :tada:
  • Table of contents
  • Math equations (with plugin)
Vue Integration:
  • Vue components in markdown
  • Template syntax
  • Script and style blocks
Use curly braces with line numbers:
Region in source file:
Use the home layout in frontmatter:
Option 1: Local Search (built-in, no setup):
Option 2: Algolia DocSearch (better for large sites):
Apply for Algolia DocSearch: docsearch.algolia.com
Customize translations and behavior:

Deployment

1. Configure base path in config:
2. Create deploy workflow .github/workflows/deploy.yml:
3. Enable GitHub Pages in repository settings to use gh-pages branch.
If deploying to a subdirectory:
Examples:
  • GitHub Pages repo: base: '/repo-name/'
  • Root domain: base: '/' (default)
  • Subdirectory: base: '/docs/'
All internal links will automatically include the base path.

Performance & Optimization

For large sites:
Other tips:
  • Use lazy-loaded languages for Shiki
  • Optimize images before adding to docs
  • Split large pages into smaller ones
  • Use dynamic imports for heavy components
No, generally don’t commit docs/.vitepress/dist/.Add to .gitignore:
Exception: If deploying manually without CI/CD, you might commit the dist folder to a deployment branch (like gh-pages).

Troubleshooting

Common causes:
  1. Vite 7 plugin compatibility: Use @ts-expect-error for incompatible plugins
  2. Missing types: Install @types/node
  3. Config errors: Check your .vitepress/config.ts syntax
Solutions:
Check:
  1. CSS import order in theme
  2. Specificity issues with custom CSS
  3. CSS variables properly defined for dark mode
  4. Scoped vs global styles
Debug:
Common causes:
  1. Wrong base path: Set correct base in config
  2. Case sensitivity: URLs are case-sensitive on most servers
  3. Missing trailing slashes: Some servers require /path/ instead of /path
  4. SPA fallback: Configure server to serve index.html for unknown routes
Solutions:
  • Verify base matches deployment path
  • Use lowercase file names
  • Configure server redirects/rewrites

Getting Help

Official Resources:Before asking:
  1. Search existing issues and discussions
  2. Check the documentation
  3. Read this FAQ
  4. Prepare a minimal reproduction
Create a GitHub issue with:
  1. Clear title: Describe the issue concisely
  2. VitePress version: Run npm list vitepress
  3. Node.js version: Run node -v
  4. Reproduction: Minimal example or repository
  5. Expected behavior: What should happen
  6. Actual behavior: What actually happens
  7. Steps to reproduce: Detailed steps
  8. Screenshots: If applicable
Tip: Use StackBlitz to create a live reproduction.
Can’t find your question? Check the official documentation or ask in GitHub Discussions.