-
Notifications
You must be signed in to change notification settings - Fork 710
Open
Description
Reproduction link or steps
- Clone https://github.com/notKamui/miniverso
git switch rolldown- Comment out this line (https://github.com/notKamui/miniverso/blob/aa845cb1545eedf9a9ffdd48e80b8cb82d35a83e/vite.config.ts#L20) (tailwind is unstable as well)
rm -rf src/routes/_authed src/routes/_authed.tsx src/routes/authpnpm i- Run
pnpm buildmultiple times
What is expected?
The generated file contains the same content even if it's built multiple times.
What is actually happening?
The generated file sometimes contains a different content.
System Info
System:
OS: Linux 6.6 Ubuntu 24.04.2 LTS 24.04.2 LTS (Noble Numbat)
CPU: (24) x64 AMD Ryzen 9 5900X 12-Core Processor
Memory: 11.29 GB / 23.47 GB
Container: Yes
Shell: 5.2.21 - /bin/bash
Binaries:
Node: 22.16.0 - ~/.local/share/asdf/data/installs/nodejs/22.16.0/bin/node
npm: 10.9.2 - ~/.local/share/asdf/data/plugins/nodejs/shims/npm
pnpm: 10.12.4 - ~/.local/share/asdf/data/installs/nodejs/22.16.0/bin/pnpm
bun: 1.2.17 - ~/.local/share/asdf/data/shims/bun
Rolldown https://github.com/rolldown/rolldown/tree/a3a4228c16289091eccb66451ce47785f7ecadbeAny additional comments?
I found that the entry order of this loop is not stable.
rolldown/crates/rolldown/src/stages/generate_stage/compute_cross_chunk_links.rs
Lines 460 to 466 in a3a4228
| for (chunk_export, _predefined_names) in index_chunk_exported_symbols[chunk_id] | |
| .iter() | |
| .sorted_by_cached_key(|(symbol_ref, _predefined_names)| { | |
| // same deconflict order in deconflict_chunk_symbols.rs | |
| // https://github.com/rolldown/rolldown/blob/504ea76c00563eb7db7a49c2b6e04b2fbe61bdc1/crates/rolldown/src/utils/chunk/deconflict_chunk_symbols.rs?plain=1#L86-L102 | |
| Reverse::<u32>(self.link_output.module_table[symbol_ref.owner].exec_order()) | |
| }) |
When there's multiple symbols that has the same owner module, the order of them were not stable.
I added
println!("export_ref: {:?}", chunk_export); in this loop and got the following outputs:
Details
export_ref: SymbolRef { owner: 88, symbol: SymbolId(4) }
export_ref: SymbolRef { owner: 193, symbol: SymbolId(1) }
export_ref: SymbolRef { owner: 193, symbol: SymbolId(3) }
export_ref: SymbolRef { owner: 202, symbol: SymbolId(3) }
export_ref: SymbolRef { owner: 60, symbol: SymbolId(101) }
export_ref: SymbolRef { owner: 6, symbol: SymbolId(4294967291) }
export_ref: SymbolRef { owner: 0, symbol: SymbolId(39) }
export_ref: SymbolRef { owner: 149, symbol: SymbolId(12) }
export_ref: SymbolRef { owner: 25, symbol: SymbolId(4) }
export_ref: SymbolRef { owner: 209, symbol: SymbolId(3) }
export_ref: SymbolRef { owner: 209, symbol: SymbolId(1) }
export_ref: SymbolRef { owner: 201, symbol: SymbolId(3) }
export_ref: SymbolRef { owner: 56, symbol: SymbolId(101) }
export_ref: SymbolRef { owner: 6, symbol: SymbolId(4294967291) }
export_ref: SymbolRef { owner: 0, symbol: SymbolId(39) }
export_ref: SymbolRef { owner: 161, symbol: SymbolId(12) }
cc @hyf0
Found while checking vitejs/rolldown-vite#325
Reactions are currently unavailable