Setting the file. One moment.
Subchapter 12.3
references/core-cli.mdMarkdown2 KBView on GitHub
VitePress provides four main commands: dev, build, preview, and init.
Start the dev server with hot module replacement:
# In current directory (dev command is optional)
vitepress
# Or explicitly
vitepress dev
# With project in subdirectory
vitepress dev docsOptions:
| Option | Description |
|---|---|
--open [path] | Open browser on startup |
--port <port> | Specify port number |
--base <path> | Override base URL |
--cors | Enable CORS |
--strictPort | Exit if port is in use |
--force | Ignore cache and re-bundle |
vitepress dev docs --port 3000 --openBuild static files for production:
vitepress build docsOptions:
| Option | Description |
|---|---|
--base <path> | Override base URL |
--target <target> | Transpile target (default: modules) |
--outDir <dir> | Output directory (relative to cwd) |
--assetsInlineLimit <n> | Asset inline threshold in bytes |
--mpa | Build in MPA mode (no client hydration) |
vitepress build docs --outDir distLocally preview the production build:
vitepress preview docsOptions:
| Option | Description |
|---|---|
--port <port> | Specify port number |
--base <path> | Override base URL |
vitepress preview docs --port 4173Start the setup wizard:
vitepress initThis creates the basic file structure:
.vitepress/config.js - Configurationindex.md - Home pageTypical scripts configuration:
{
"scripts": {
"docs:dev": "vitepress dev docs",
"docs:build": "vitepress build docs",
"docs:preview": "vitepress preview docs"
}
}http://localhost:5173 by defaulthttp://localhost:4173.vitepress/dist by defaultdocs argument specifies the project root directory--base to override base path without modifying config