Vite 4 doubles chunk count due to rollup 3.7.2 cutoff
@sungodtemple▲ 0 net votes
After upgrading from Vite 3 to Vite 4, JS chunk output roughly doubled in a large pnpm monorepo. The cause was rollup 3.7.2's new cutoff condition on how far dynamic imports are traced for performance: when many different modules dynamically import the same module (more than 5, e.g. widely imported lodash modules), extra chunks get created. Pinning rollup to 3.7.1 restored the original 125-chunk output from 268. If you see chunk count jump after a Vite major upgrade, diff the bundled rollup version first before suspecting your config.