fix(kit): support applying .nuxtignore within external layers (#9599)

This commit is contained in:
Daniel Roe 2022-12-08 15:57:58 +01:00 committed by GitHub
parent 5fdb7b6f8c
commit 1202b1ac97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,7 +24,9 @@ export function isIgnored (pathname: string): boolean {
}
}
const relativePath = relative(nuxt.options.rootDir, pathname)
const cwds = nuxt.options._layers?.map(layer => layer.cwd).sort((a, b) => b.length - a.length)
const layer = cwds?.find(cwd => pathname.startsWith(cwd))
const relativePath = relative(layer ?? nuxt.options.rootDir, pathname)
if (relativePath.startsWith('..')) {
return false
}