PRODUCT.ENGINEER
ManifestoThe RolePlaybookLoops
All loops
ReviewingManual

Bundle Diet

Analyze bundle size, remove/replace heavy deps until budget met.

Compatible tools:Claude CodeCursor
Start the "Bundle Diet" loop.

- Goal: Production bundle size is under the target budget (set in project config or default: main JS bundle < 200KB gzipped).
- Max iterations: 8
- Between iterations run: `npm run build && du -sh .next/static/chunks/*.js | sort -rh | head -10`
- Exit when: total JS bundle size is under the target budget.

Steps:
1. Run a production build and analyze the bundle (next/bundle-analyzer, source-map-explorer, or size-limit)
2. If bundle is under budget, stop — exit condition met
3. Identify the largest contributors by size
4. For each heavy dependency, evaluate:
   - Can it be replaced with a lighter alternative? (moment → dayjs, lodash → native)
   - Can it be loaded dynamically/lazily? (next/dynamic, React.lazy)
   - Is it actually used, or can it be removed entirely?
   - Can tree-shaking be improved? (import specific modules, not the whole library)
5. Apply the highest-impact optimization
6. Rebuild and measure the size reduction
7. Repeat with the next largest contributor

Self-pacing instructions: After each iteration, run the check command, read the output, and only continue if the exit condition is not met. Stop when exit condition passes or max iterations reached. Give a short status update each pass.

How it works

Bundle Diet

yesoverswapdeferAnalyze bundleUnder budget?Find heaviest depReplace or lazy-load?Swap for lighter altDynamic importBudget met
product.engineer

Owning the whole loop, from idea to impact.

Learn

  • Blog
  • Manifesto
  • Authors
  • RSS Feed

Tools

  • Loops
  • Playbook
  • Discovery
  • Cloud Maturity
  • 5 Whys

Opportunities

  • Jobs
  • Hot Jobs
  • Companies
  • The Role
© 2026 product.engineer
||