fix(nuxt): sort pages/ files in en-US locale (#25195)

This commit is contained in:
Kiarttipum Charoenpojvajana 2024-01-14 18:54:23 +07:00 committed by GitHub
parent 98fb2be07f
commit 540a5cc78b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -51,7 +51,9 @@ export async function resolvePagesRoutes (): Promise<NuxtPage[]> {
const files = await resolveFiles(dir, `**/*{${nuxt.options.extensions.join(',')}}`)
scannedFiles.push(...files.map(file => ({ relativePath: relative(dir, file), absolutePath: file })))
}
scannedFiles.sort((a, b) => a.relativePath.localeCompare(b.relativePath))
// sort scanned files using en-US locale to make the result consistent across different system locales
scannedFiles.sort((a, b) => a.relativePath.localeCompare(b.relativePath, 'en-US'))
const allRoutes = await generateRoutesFromFiles(uniqueBy(scannedFiles, 'relativePath'), nuxt.options.experimental.typedPages, nuxt.vfs)