From 540a5cc78b7bc5ef11f052f4c27a8435eb34bdd2 Mon Sep 17 00:00:00 2001 From: Kiarttipum Charoenpojvajana <9075342+44kia244@users.noreply.github.com> Date: Sun, 14 Jan 2024 18:54:23 +0700 Subject: [PATCH] fix(nuxt): sort `pages/` files in `en-US` locale (#25195) --- packages/nuxt/src/pages/utils.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/nuxt/src/pages/utils.ts b/packages/nuxt/src/pages/utils.ts index f24ba65aa5..559723be71 100644 --- a/packages/nuxt/src/pages/utils.ts +++ b/packages/nuxt/src/pages/utils.ts @@ -51,7 +51,9 @@ export async function resolvePagesRoutes (): Promise { 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)