ΠžΠΏΡƒΠ±Π»Ρ–ΠΊΠΎΠ²Π°Π½ΠΎ:


πŸ“’: Avoid Barrels

(A barrel is a file that exports code from other files)

Barrel benefits:
βœ… Shorter import paths
βœ… Support importing many files via one import
βœ… "Hide" modules - Only export some modules for the "public" interface

But, I avoid barrels. Here's why:
🚫 Bloats the bundle. Inhibits tree shaking.
🚫 Increases memory usage.
🚫 Slows tooling (builds, tests, linting). Barrels create more modules to parse.
🚫 Slows code navigation ("Find all references" finds the barrel instead of the actual source).
🚫 Barrels shorten import paths and group related imports. Sounds nice, but it's an outdated benefit because I don't write imports anymore - my editor reliably auto-imports.