Open sapphi-red opened 4 hours ago
related to
https://github.com/rolldown/rolldown/blob/00fa6ffd8e20cf567c5fba5b6741273a0d87830c/crates/rolldown_common/src/types/rollup_rendered_chunk.rs#L18-L18
FxHashmap
did not guarantee order.
A little curious about why vite
care about modules
keys order?
Vite traverses the modules
and concatenate all CSS linked to those modules
. If the order is not deterministic, the bundle output hash gets non-deterministic.
Given that Vite will use rolldown's internal CSS handle mechanism, this line won't be a problem anymore. I think it's a nice-to-have and not urgent.
Vite traverses the
modules
and concatenate all CSS linked to thosemodules
. If the order is not deterministic, the bundle output hash gets non-deterministic. Given that Vite will use rolldown's internal CSS handle mechanism, this line won't be a problem anymore. I think it's a nice-to-have and not urgent.
Understood
Reproduction link or steps
pnpm i && pnpm build
cd playground/css-codesplit
pnpm build
multiple timeassets/main-h8NuCY-I.css
orassets/main-A25c-rgU.css
existsThe result of this line changes: https://github.com/rolldown/vite/blob/d0518d3cff2439e864a98b6e51993ed18b254bcb/packages/vite/src/node/plugins/css.ts#L600
What is expected?
The order of the keys in
modules
property inRenderedChunk
is deterministic.What is actually happening?
The order of the keys in
modules
property inRenderedChunk
is not deterministic and changes some times even if the input is same.System Info
Any additional comments?
In some case, it seems it's not deterministic in Rollup: https://github.com/rollup/rollup/issues/3682 Note that in this case modules have
moduleSideEffects: 'no-treeshake'
set.