From b9906dc605f53fdffd268a9086af0bb7b60ee125 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bryan=20M=C3=BCller?= Date: Fri, 19 Nov 2021 22:10:24 -0600 Subject: [PATCH] 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. --- src/node/config.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/node/config.ts b/src/node/config.ts index 4fdc21171a71..c27bd758c377 100644 --- a/src/node/config.ts +++ b/src/node/config.ts @@ -47,6 +47,7 @@ export interface UserConfig { 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),