feat(config): allow user-defined outDir in config

Update UserConfig to accept an optional outDir and resolve it the same way vitepress resolves srcDir. The original .vitepress/dist behavior is provided as fallback if no user-provided outDir is present. For reference, see #170.
pull/448/head
Bryan Müller 4 years ago
parent 3c57619a10
commit b9906dc605
No known key found for this signature in database
GPG Key ID: AC53759C024484A6

@ -47,6 +47,7 @@ export interface UserConfig<ThemeConfig = any> {
srcDir?: string
srcExclude?: string[]
outDir?: string
/**
* Enable MPA / zero-JS mode
@ -94,6 +95,7 @@ export async function resolveConfig(
const [userConfig, configPath] = await resolveUserConfig(root, command, mode)
const site = await resolveSiteData(root, userConfig)
const srcDir = path.resolve(root, userConfig.srcDir || '.')
const outDir = path.resolve(root, userConfig.outDir || resolve(root, 'dist'))
// resolve theme path
const userThemeDir = resolve(root, 'theme')
@ -121,7 +123,7 @@ export async function resolveConfig(
themeDir,
pages,
configPath,
outDir: resolve(root, 'dist'),
outDir,
tempDir: path.resolve(APP_PATH, 'temp'),
markdown: userConfig.markdown,
alias: resolveAliases(themeDir),

Loading…
Cancel
Save