The agent adds date-fns because “we needed formatDistance . It’s a small helper.” The PR description says the change is three lines. The client bundle disagrees: you just bought a tree-shaking argument and a few extra kilobytes you never looked at.
I’ve started treating dependency adds without a cost artifact as incomplete, not obviously fine. “Harmless” is a claim. The analyzer JSON is the evidence.
What usually goes wrong
Trust the import style — import { formatDistance } from "date-fns" is supposed to tree-shake. Sometimes it does. Sometimes a default import, a plugin gap, or a CJS interop path pulls more than the function.
Trust the README — “tree-shakable” and “2 kB” may describe the ideal ESM entry, not what your bundler emitted for this app.
Compare to the wrong baseline — a helper can be small in isolation and still be the first time a large locale table or polyfill lands in the main graph.
Skip the graph — a package you already ship may already expose the same utility.…