Turbopack: Sort chunk items by module ID for deterministic content hashes
Different routes perform independent DFS traversals from different entry points, producing different topological orderings of shared modules. Since production chunk filenames are derived from content hashes of the serialized JS bytes, this ordering instability causes the same set of modules to produce chunks with different filenames across routes, leading to duplicate downloads. Fix by sorting chunk items by ModuleId before serialization in both browser and Node.js chunk content emitters. This ensures identical module sets always produce identical content hashes regardless of traversal order.
Showing
Please
register
or
sign in
to comment