Dabish Digital
Development

What to ask your agency about JavaScript bundle size

The gap between knowing this and actually doing it is where most teams lose ground. If you are briefing an agency or a freelancer on JavaScript bundle size, these questions are worth asking early.

The question is rarely whether something can be built, but what it costs to keep running afterwards. Anything you cannot measure here, you are deciding by taste, which is fine as long as everyone knows it.

Questions worth asking

  • Who will actually do this work, and have they done it before?
  • How will we know afterwards whether it worked?
  • What happens if it needs changing in a year?
  • What are you assuming that we have not confirmed?

What a good answer sounds like

Every kilobyte of JavaScript costs more than a kilobyte of image. That sounds obvious written down. It is still the thing most often skipped. Assume whoever inherits this will have half your context and none of your patience.

Measure the bundle before optimising anything else. The teams that handle this well are rarely the ones with the biggest budgets. The practical test is whether someone new to the project could tell, in a minute, that it had been handled.

The short version

Code gets read far more often than it gets written, and usually by someone with less context than the author had. Three things worth confirming about JavaScript bundle size before you move on:

  • Someone can say what the current setup is without going to look
  • Most sites ship libraries for features they barely use — and you know whether that is true here
  • There is a way to tell whether the last change to this helped

Most of the value here comes from doing the first two things, not all of them.