Saving the web from Javascript bloat
Theo covers James Garbet's article "The Three Pillars of JavaScript Bloat."
The 3 pillars of JS bloat
1. Older Runtime Support & "Safety"
- Packages like
is-stringhave deep dep trees just to support ES3 (IE6/7) or ancient Node. Almost nobody needs this. - Hero Devs maintains ancient codebases — once added 60 deps to
axe-object-queryfor Node 0.4 compat, nearly doubling SvelteKit's deps. - Some packages exist purely to protect against global namespace mutation (e.g.,
math-intrinsicsre-exports Math functions). - Cross-realm values (iframe vs parent) require workarounds instead of
instanceof.
2. Atomic Architecture
- Packages split to absurd granularity:
shebang-regex(2 lines) gets 133M downloads/week.slashgets 96M/week.path-key(4KB) gets 158M/week. - Most are used by exactly ONE other package by the same author — inline code with extra npm overhead.
- Duplicated versions compound the problem.
- Bigger supply chain attack surface.
3. Ponyfills That Overstayed Their Welcome
- Ponyfills stick around forever after native support ships.
globalThisponyfill: 49M downloads/week (native since 2019).object.entries: 35M/week (native since 2017).indexOf: 2.3M/week (native since 2010).
What to do
- E18 Foundation — essential cleanup work, pruning redundant packages.
kniptool finds unused deps, dead code, unused imports.- E18 CLI with
analyzemode recommends replacements. module-replacementsproject lists modern alternatives.- npmx.dev for exploring dependency graphs.
- Theo donated $5,000 to E18 (total balance was only $17K).