In a discussion on proper file organization in frontend development, the author argues against using barrel files in JavaScript and TypeScript projects. Barrel files, which re-export components from a single file, can lead to circular imports and decreased development speed due to unnecessary module loading. While useful in library entry points, they create complications in application code, making it harder to manage imports and debug errors. Instead, consistent and straightforward import practices are recommended.

6m read timeFrom tkdodo.eu
Post cover image
Table of contents
What are barrel files?Circular importsDevelopment speedWhat barrels are good for
5 Comments

Sort: