Skip to content

Commit 6ab4f8b

Browse files
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.
1 parent 59beba7 commit 6ab4f8b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

packages/next/src/build/webpack/plugins/flight-manifest-plugin.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ export class ClientReferenceManifestPlugin {
297297
manifest.entryCSSFiles[chunkEntryName] = entrypoint
298298
.getFiles()
299299
.filter((f) => !f.startsWith('static/css/pages/') && f.endsWith('.css'))
300+
.sort() // Sort CSS files to ensure consistent order between dev and build
300301
.map((file) => {
301302
const source = compilation.getAsset(file)!.source.source()
302303
if (

0 commit comments

Comments
 (0)