Codemod-ing away 4MB of JavaScript | Spencer Miskoviak
HTML-код
- Опубликовано: 12 сен 2024
- "Tree shaking (dead code elimination) can be an invaluable feature in modern build tools to keep bundle sizes slim. Unfortunately, it's can also be easy to ""break"" and overlook with a single import star (import *). Imagine this slips in and is overlooked for months, only to later realize it adds over 4 megabytes. But now, its implicitly relied upon in hundreds of places.
This is a story about creating a custom codemod transform to update hundreds of implicit usages to be explicit imports to ""fix"" tree shaking and remove nearly 97% of the unused code."