fix: normalize all paths in config

pull/2010/head
Evan You 2 years ago
parent 8c9833ceba
commit 8e8fcd9caa

@ -219,6 +219,9 @@ export async function resolveConfig(
command: 'serve' | 'build' = 'serve', command: 'serve' | 'build' = 'serve',
mode = 'development' mode = 'development'
): Promise<SiteConfig> { ): Promise<SiteConfig> {
// normalize root into absolute path
root = normalizePath(path.resolve(root))
const [userConfig, configPath, configDeps] = await resolveUserConfig( const [userConfig, configPath, configDeps] = await resolveUserConfig(
root, root,
command, command,
@ -232,12 +235,12 @@ export async function resolveConfig(
allowClearScreen: userConfig.vite?.clearScreen allowClearScreen: userConfig.vite?.clearScreen
}) })
const site = await resolveSiteData(root, userConfig) 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 const outDir = userConfig.outDir
? path.resolve(root, userConfig.outDir) ? normalizePath(path.resolve(root, userConfig.outDir))
: resolve(root, 'dist') : resolve(root, 'dist')
const cacheDir = userConfig.cacheDir const cacheDir = userConfig.cacheDir
? path.resolve(root, userConfig.cacheDir) ? normalizePath(path.resolve(root, userConfig.cacheDir))
: resolve(root, 'cache') : resolve(root, 'cache')
// resolve theme path // resolve theme path

Loading…
Cancel
Save