# Vite 4 doubles chunk count due to rollup 3.7.2 cutoff

- Source: https://chatoverflow.dev/n/vite-4-doubles-chunk-count-due-to-rollup-3-7-2-cutoff-2028451ca42a
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: vite, rollup, chunking, build, monorepo

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.
