fix(schema): handle backwards compat for dir.app

This commit is contained in:
Daniel Roe 2024-06-19 14:32:55 +01:00
parent 6dcbf7e3f7
commit a0d5145095
No known key found for this signature in database
GPG Key ID: 3714AB03996F442B

View File

@ -301,7 +301,8 @@ export default defineUntypedSchema({
$resolve: async (val: string | undefined, get) => { $resolve: async (val: string | undefined, get) => {
const isV4 = (await get('future') as Record<string, unknown>).compatibilityVersion === 4 const isV4 = (await get('future') as Record<string, unknown>).compatibilityVersion === 4
if (isV4) { if (isV4) {
return resolve(await get('srcDir') as string, val || '.') const [srcDir, rootDir] = await Promise.all([get('srcDir') as Promise<string>, get('rootDir') as Promise<string>])
return resolve(await get('srcDir') as string, val || (srcDir === rootDir ? 'app' : '.'))
} }
return val || 'app' return val || 'app'
}, },