Dev.to
6/17/2026

Beyond Missing Exports: Building an Early Garbage Collector for Webpack’s TypeDoc AST
Short summary
This article describes solving a TypeDoc plugin integration problem in Webpack by hooking into the AST lifecycle to perform early garbage collection. The author experimented with three approaches, discovered that recursive type extraction created noise, then implemented a targeted solution that intercepts the AST after resolution but before memory allocation, filtering unneeded nodes and lifting essential types to the root scope. The approach prevents memory overhead while maintaining documentation completeness.
- •TypeDoc plugin created memory overhead by including ~600 nested types in documentation
- •Solution: hook into Converter.EVENT_RESOLVE_END to remove unneeded AST nodes before memory allocation begins
- •Result: delivered ~300 essential types with clean navigation, avoiding recursive noise
Generated with AI, which can make mistakes.
Is this a good recommendation for you?



