mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +00:00
fix: store augmented pages with file path
This commit is contained in:
parent
9d3b43a6c8
commit
59d0d2de7a
@ -140,19 +140,19 @@ export function generateRoutesFromFiles (files: ScannedFile[], options: Generate
|
||||
return prepareRoutes(routes)
|
||||
}
|
||||
|
||||
export async function augmentPages (routes: NuxtPage[], vfs: Record<string, string>, augmentedPages = new Set<string>()) {
|
||||
export async function augmentPages (routes: NuxtPage[], vfs: Record<string, string>, augmentedPagesWithPaths = new Set<string>()) {
|
||||
for (const route of routes) {
|
||||
if (route.file && !augmentedPages.has(route.file)) {
|
||||
if (route.file && !augmentedPagesWithPaths.has(route.file)) {
|
||||
const fileContent = route.file in vfs ? vfs[route.file] : fs.readFileSync(await resolvePath(route.file), 'utf-8')
|
||||
Object.assign(route, await getRouteMeta(fileContent, route.file))
|
||||
augmentedPages.add(route.file)
|
||||
augmentedPagesWithPaths.add(`${route.file}_${route.path}`)
|
||||
}
|
||||
|
||||
if (route.children && route.children.length > 0) {
|
||||
await augmentPages(route.children, vfs)
|
||||
}
|
||||
}
|
||||
return augmentedPages
|
||||
return augmentedPagesWithPaths
|
||||
}
|
||||
|
||||
const SFC_SCRIPT_RE = /<script(?<attrs>[^>]*)>(?<content>[\s\S]*?)<\/script[^>]*>/i
|
||||
|
Loading…
Reference in New Issue
Block a user