Skip to content

Commit

Permalink
feat(config): allow user-defined outDir in config
Browse files Browse the repository at this point in the history
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 vuejs#170.
  • Loading branch information
Mando75 committed Nov 20, 2021
1 parent 3c57619 commit b9906dc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/node/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export interface UserConfig<ThemeConfig = any> {

srcDir?: string
srcExclude?: string[]
outDir?: string

/**
* Enable MPA / zero-JS mode
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit b9906dc

Please sign in to comment.