Design Sundae
← Journal
AIDesign Sundae Team

An AI agent that trims your JavaScript: Next.js's bundle optimizer

An agent skill found almost 2 MB of unneeded JavaScript in Vercel apps.

An AI agent that trims your JavaScript: Next.js's bundle optimizer cover

Page speed is part of design. A beautiful page that waits on JavaScript still feels slow. On 28 October 2026 the Next.js team shared a new way to find that weight: an agent skill called next-bundle-optimizer, built on the Turbopack bundle analyzer in Next.js 16.4.

How it works

The skill gives an AI agent the app's module graph. The agent looks for large groups of connected code, traces how they are imported, and proposes the fewest changes that would let that code load later. It also flags duplicate dependencies, code that could move to React Server Components, and imports that block tree shaking. By default it only reports. Run it with fix and it applies the changes and measures them again.

The results at Vercel

Across v0 and vercel.com, the agent found almost two megabytes of compressed JavaScript that was loading too early or not needed at all. One example: an experimental editor loaded on nearly every page, even for users outside the experiment.

For people, too

Running next analyze now shows your largest routes first, saves snapshots you can compare, and can show only the code needed for the first render.

Our take

This is the kind of AI help we like: it finds a problem, shows its working, and a person reviews the change before it ships.

Sources