NorthwindNorthwind
← All posts

How We Reduced Our Bundle Size by 60%

Three changes — a moment.js eviction, route-level code splitting, and tree-shaking a barrel file — cut 60% off our JS.

Sofia Alvarez · 1 min read
Share

Our main bundle was 480KB gzipped. First load on a mid-tier phone was brutal. We got it to 190KB with three changes.

1. Evict the heavyweights

moment with all locales was 70KB alone. We swapped to a 6KB date helper.

2. Split by route

const Settings = lazy(() => import("./Settings"));

The settings page is huge and rarely the first thing a user opens. Splitting it moved 90KB off the critical path.

3. Kill the barrel file

A single index.ts re-exporting everything defeated tree-shaking — importing one icon pulled the whole set. We imported deep paths instead.

Measure with a real device and a throttled network. Your laptop lies to you about performance.
Share

More to read

Related posts