I've unfortunately learned the hard way at this. I love barreling and it does clean up your code considerably... But it harms all of the bundlers ability to tree shake (even when you have all the output for ES2017 or newer).
I'm currently undergoing a massive refactor in which I'm stripping all the barrels.
To be honest, me neither. What I ended up doing was only barreling those files that I know they were going to be used together, and manually removing each of the other ones... Yes, I spent many many hours in the refactor... But it was worth it.
Plus I used type aliases (works both on Babel and TypeScript) to better index my applications.
Some comments have been hidden by the post's author - find out more
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Webpack has issues tree shaking this.
I've unfortunately learned the hard way at this. I love barreling and it does clean up your code considerably... But it harms all of the bundlers ability to tree shake (even when you have all the output for ES2017 or newer).
I'm currently undergoing a massive refactor in which I'm stripping all the barrels.
what did you do instead. I'm planning to do the same removing the barrel. but i couldn't find the right way.
My file importing so many components that I ended up have more than 50 lines only importing components
To be honest, me neither. What I ended up doing was only barreling those files that I know they were going to be used together, and manually removing each of the other ones... Yes, I spent many many hours in the refactor... But it was worth it.
Plus I used type aliases (works both on Babel and TypeScript) to better index my applications.