Post

Rolldown was over-splitting compared to Rollup, I had to manually configure some groups. It has something to do with cycles across chunks and modules imported both through a static and dynamic imports chain, but I cannot get a minimal reproduction to show the same behavior.

0 reposts5 likes

Tried now, unfortunately it's not very helpful. In my case it's telling me that chunk C is its own chunk because it's imported both by chunk A and chunk B, which is indeed true, but it does not explain why it cannot just put it inside chunk A (where chunk B is only imported through import() by A)

Actually, this AI-generated and not Vite-generated graph shows exactly my situation 😛 With this graph shape, Rolldown is automatically splitting what's called "vendor" here into its own chunk, while Rollup was putting it together with "index". There is no reason to split it as far as I can tell.

And this was happening for a whole bunch of modules, causing the number of chunks to increase from ~50 to ~80. The solution in this example would be to manually define a group containing the entry point of the "index" chunk, and then it automatically includes what would otherwise be in "vendor"

Also, for some reason (even if the docs say otherwise) Vite 7 was prioritizing the "package.json#module" field in some of my dependencies while Vite 8 prioritizes "package.json#browser", which caused a bunch of different stuff to be loaded.