Codemod-ing away 4MB of JavaScript | Spencer Miskoviak
React Conf React Conf
36.2K subscribers
5,027 views
102

 Published On Oct 30, 2019

"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."

show more

Share/Embed