Why I stopped writing barrel files
Tree-shaking, IDE perf, and the hidden cost of `import * from`.
Barrel files — those innocent-looking `index.ts` files that re-export everything from a folder — are slowly killing your build. They look ergonomic but they're a tree-shaking nightmare, an IDE performance bomb, and a circular-import minefield.
Modern bundlers technically handle re-exports, but 'technically' hides a lot. A barrel-imported icon can drag in 40 other icons even when only one is used. Multiply that across a 200-component library and you're shipping megabytes of dead code.
My rule now: import from the file, not the folder. `import from './button'`, never `from './components'`. Yes, the import paths get longer. Yes, the build is faster.