Before agents, bundlers made sites faster mostly through static analysis: tree shaking and minification ship less code. That still matters.
But bundle size is only a proxy. Users feel how soon the page shows up: FCP (first content on screen) and LCP (largest content on screen, a Core Web Vital).
The usual fix is to load only the code the first paint needs, and lazy-load the rest. Which code that is depends on what runs in the browser, and static analysis can't see it.
By hand, that means maintaining a measuring harness, reading browser coverage, and testing every change against noise. It takes hours or days per fix, so speed work became a separate phase after deploy.