Skip to content

Laboratory · Architecture Lab

What does a barrel file cost?

Briefing

Why does importing a single helper from a barrel file sometimes pull in an entire package, and why does tree shaking not save you?

One tidy index.ts, one import, and suddenly the route bundle contains a charting library nobody on that page uses.

Laboratory
Architecture Lab
Level
SYSTEMS
Estimated time
8 minutes
Method
investigation
Variables under observation
barrel filestree shakingside effectsmodule graphbundling