-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Open
Labels
Description
Describe the bug
The vitepress build script recognizes the --outDir argument. For example,
- default script:
"docs:build": "vitepress build"builds the./.vitepress/distfolder; - custom script:
"docs:build": "vitepress build --outDir './dist"'builds the./distfolder.
However, the vitepress preview script cannot locally preview the project in a different folder. For example,
- default script:
"docs:preview": "vitepress preview"considers the./.vitepress/distfolder; - custom script: there is no way to preview the project that was built on the
./distfolder.
Workaround: setting '../dist' as the value of outDir option on config.js satisfies the expected result when running vitepress preview. The considered folder becomes ./dist as expected.
Reproduction
https://stackblitz.com/edit/vite-tyd3c7?file=package.json
Expected behavior
The script docs:preview correctly recognizes the modified outDir folder.
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
brc-dd commentedon Jul 25, 2024
vitepress previewdoesn't accept flags via CLI (except for base and port as the docs mention). You need to specify such things in config directly, or you can use some other server likenpx serve ./path/to/your/distwhich would work too.vitepress serveis alias ofvitepress preview. serve was there earlier, I'll update the command in stackblitz to align more for new users.[-]'vitepress preview' command only considers the default dist folder[/-][+]support specifying `outDir` in `vitepress preview`[/+]