From 8e8fcd9caa4194787c5fc81ad10d17cf82638b8f Mon Sep 17 00:00:00 2001 From: Evan You Date: Tue, 28 Feb 2023 17:42:39 +0800 Subject: [PATCH] fix: normalize all paths in config --- src/node/config.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/node/config.ts b/src/node/config.ts index 65dd2340..1e3d6344 100644 --- a/src/node/config.ts +++ b/src/node/config.ts @@ -219,6 +219,9 @@ export async function resolveConfig( command: 'serve' | 'build' = 'serve', mode = 'development' ): Promise { + // normalize root into absolute path + root = normalizePath(path.resolve(root)) + const [userConfig, configPath, configDeps] = await resolveUserConfig( root, command, @@ -232,12 +235,12 @@ export async function resolveConfig( allowClearScreen: userConfig.vite?.clearScreen }) const site = await resolveSiteData(root, userConfig) - const srcDir = path.resolve(root, userConfig.srcDir || '.') + const srcDir = normalizePath(path.resolve(root, userConfig.srcDir || '.')) const outDir = userConfig.outDir - ? path.resolve(root, userConfig.outDir) + ? normalizePath(path.resolve(root, userConfig.outDir)) : resolve(root, 'dist') const cacheDir = userConfig.cacheDir - ? path.resolve(root, userConfig.cacheDir) + ? normalizePath(path.resolve(root, userConfig.cacheDir)) : resolve(root, 'cache') // resolve theme path