Turbopack: Fix non-deterministic chunk item ordering after merge_chunks integration
After integrating merge_chunks into production.rs, chunk items were being
collected in the order that groups were merged, which is non-deterministic
due to hash map iteration order and heap operations in the merge algorithm.
The merge algorithm extends group_indices and batch_group_ids in whatever
order groups are encountered during merging. When production.rs iterates
over these unsorted indices to collect chunk items, the same set of modules
produces different output orders across builds.
Fix by sorting group_indices and batch_group_ids before iterating over them
to collect chunk items. This ensures deterministic output regardless of the
merge algorithm's internal ordering.
Co-Authored-By:
Claude Sonnet 4.5 <noreply@anthropic.com>
Showing
Please
register
or
sign in
to comment