From 6ab4f8babf50b6053f087d60b51e532de36fca29 Mon Sep 17 00:00:00 2001 From: harshcoder-harsh Date: Wed, 3 Dec 2025 22:27:46 +0530 Subject: [PATCH] fix: ensure consistent CSS ordering between dev and build with Turbopack Fixes #86704 The issue was that CSS files were collected from webpack entrypoints without sorting, leading to non-deterministic ordering between development (next dev --turbopack) and production (next build --turbopack). This commit adds .sort() to the CSS files array in flight-manifest-plugin.ts to ensure consistent alphabetical ordering in both modes. The fix ensures that CSS prioritization is deterministic and matches between dev and build, preventing layout breakage in production. --- .../next/src/build/webpack/plugins/flight-manifest-plugin.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/next/src/build/webpack/plugins/flight-manifest-plugin.ts b/packages/next/src/build/webpack/plugins/flight-manifest-plugin.ts index 2786b0d8f122b6..4430899994536b 100644 --- a/packages/next/src/build/webpack/plugins/flight-manifest-plugin.ts +++ b/packages/next/src/build/webpack/plugins/flight-manifest-plugin.ts @@ -297,6 +297,7 @@ export class ClientReferenceManifestPlugin { manifest.entryCSSFiles[chunkEntryName] = entrypoint .getFiles() .filter((f) => !f.startsWith('static/css/pages/') && f.endsWith('.css')) + .sort() // Sort CSS files to ensure consistent order between dev and build .map((file) => { const source = compilation.getAsset(file)!.source.source() if (