Codemod-ing away 4MB of JavaScript
summary
A custom codemod converts hundreds of implicit font references into explicit imports and removes a single import-star that drags in 4.5k icons pulled in by import , shrinking a problematic chunk by about 4MB and eliminating roughly 97% of the unused icon code*; it uses jscodeshift on ASTs, a test-driven transform that handles string and array icon syntaxes, deduplicates imports and avoids naming collisions, and yields ~20% smaller bundle and far fewer parse-and-download bytes.
AI-written summary · about
chapters (3)
related talks
53mThe Unbearable Weight of Massive JavaScript
15mThe Superpower of ASTs: How We Saved 16% on Our Bundle Size
21mMonsters of Web Performance
16mThe art of tree-shaking
27mHow Codemods Turned a Nightmare into a 3-Minute Migration
16mThe Art of Tree-Shaking
58mResponsible JavaScript
23mDecoding Javascript: Loading Performance
