DEV Community

Discussion on: Barrel files and why you should STOP using them now

Collapse
 
zalithka profile image
Andre Greeff

wow... that's fascinating. in hindsight, it makes perfect sense, but I honestly never thought about this.

I just tested this with an Angular project, created a production build as I had it (using barrel files), then went through and removed them, adjusting my imports accordingly, and the production build I made afterwards is substantially smaller! like.. 752.86 kB before down to 186.11 kB afterwards! honestly did not expect that much of a difference.

my work laptop is horrifically underpowered, to the point that it doesn't even handle ESlint checking things in the background while I code.. it seems like Biome doesn't kill it as badly though, so I'm definitely going to tell it to throw things at me if I try use barrel files again!

thanks for sharing this.. :)

Collapse
 
zalithka profile image
Andre Greeff • Edited

quick follow up here: the e18e website "Resources" page conveniently provides a direct link to Biome's noBarrelFile lint rule.

Collapse
 
tassiofront profile image
Tássio

Woow!! What an extraordinary result, @zalithka!! 😮 We are also getting nice results where I have been working.

How about the unit tests, have you noticed any improvement?

Thanks for sharing your amazing results and Biome (I have heard about it before, I will explore)!