How I Trimmed Bundle Size on a Legacy Web App — Without Rewriting It

Practical steps I used to trim bundle size on a legacy web app, improve load times for users on budget phones, and avoid a full rewrite.

Written by: Arjun Malhotra

A developer's laptop showing code on screen with a cup of coffee, photographed from above
Image credit: Jeremy Yap / Unsplash

We shipped a new feature and the complaints started coming fast: “site takes forever on my phone,” “can’t open on 2G,” “mobile data drains.” Our app was a decade-old single-page app with polite architecture but heavy habits: big vendor bundles, polyfills for everything, and a tendency to pack images and fonts into the main payload.

We considered a rewrite. Then we measured. Rewrites are seductive—but expensive, risky, and slow. Instead, we focused on a different bet: trim bundle size incrementally and get results in weeks, not months. Here’s the playbook that worked for us, the tradeoffs we learned, and how to avoid common pitfalls.

Start with numbers, not opinions

Find the low-hanging fruit

Code-splitting, the practical way

Assets, fonts, and images matter

Leverage modern build features

Real tradeoffs and constraints

Measure the wins After three sprints of focused work (not a full rewrite), our concrete results:

A few tactical commands and tools we found indispensable

Final position: don’t rewrite first If your app is slow on real users, a rewrite is rarely the fastest path to better user experience. Focus first on measuring, trimming, and tactical upgrades. A pragmatic campaign to trim bundle size gives immediate user benefits and often buys you the time to plan a more ambitious re-architecture, if you still need it.

If you’re starting, my recommendation is simple: measure, remove, and lazy-load. Expect some developer cost and a bit more build complexity, but the payoff is often worth it — especially if many of your users are on budget phones or constrained data plans in India.

We stopped a rewrite, shipped faster experiences, and learned where our real technical debt lives. That felt like a win worth more than a perfect codebase.