The Blacksmith's First Un-tempered Blade: On the Deceptive Sharpness of a Perfectly Minified Bundle Without Tree Shaking
We have been taught to worship at the altar of the kilobyte. For years, the received wisdom has been clear and singular: make the bundle smaller. Minify, compress, and crush our JavaScript into a dense, compact nugget. We celebrate shaving off another few milliseconds of download time, polishing our metrics until they gleam. But in our fervent pursuit of the small, we have quietly abandoned a more crucial principle: the pursuit of the necessary.
This is the story of the perfectly minified, yet utterly untempered, bundle. It is a blade honed to a razor's edge, yet forged from brittle, flawed steel. The minifier has done its job with ruthless efficiency, stripping every comment, shortening every variable, and removing every whitespace. The bundle size report is a thing of beauty. But the minifier, in its glorious stupidity, has also packed every last line of legacy code, every deprecated utility function from three projects ago, and every polyfill for a browser that has been dust for half a decade. It is a ship in a bottle, containing not just the vessel, but the entire workshop, the shipwright's lunch, and the sawdust on the floor.
The Illusion of the Small
We are lulled into a false sense of performance by this small number. We point to it as proof of our craft. But we are not sending a precise tool; we are sending an entire toolbox and asking the user's browser to find the screwdriver. The browser must still parse, compile, and execute all this code, whether it is used or not. The download may be quick, but the main thread is choked with the weight of unused possibilities.
This is where the art of tree shaking—the deliberate, thoughtful exclusion of dead code—becomes the true craft. It is the tempering process. A blacksmith doesn't just pound metal into a thin, sharp strip; they fold it, heat it, and quench it to align the internal structure, to remove the impurities that make it brittle. Tree shaking is this alchemical process for code. It requires a deep understanding of the module graph, of what is imported and what is merely present. It is not automated in the same blind way; it demands intention and configuration.
To ship a minified-but-unshaken bundle is to boast of a blade's sharpness while ignoring the fatal crack running through its core. It will look perfect in the scabbard, its weight and balance will feel right, but the first time it meets resistance—the first time a user on a modest device tries to interact with it—it will shatter. The performance cost is not in the download, but in the silent, expensive work of processing code that will never be called. It is the heaviest kind of lightness. True performance isn’t just about how fast something arrives; it’s about how little work it creates once it’s there.
Notes & further reading
A few pages I came back to while writing this:
- The Glassblower's First Un-tempered Vessel: On the Brittle Fragility of a Perfectly Sized Image Without an `aspect-ratio`
- The Weaver's First Un-tensioned Loom: On the Deliberate Slack of a Perfectly Un-optimized Font
- The Cartographer's First Un-scaled Chart: On the Precise Placement of a Perfectly Anchored Pop-Up