bencoveney / barrelsby

Automatic TypeScript barrels (index.ts files) for your entire code base

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tree shaking?

tomByrer opened this issue · comments

Does this hinder code reduction via tree-shaking?

Seems like a good idea; helpful in UI collections.

commented

@tomByrer I don't have a definitive answer for that. Based on my understanding we'd need to be compiling to ES6 which we are doing. However, I'm not sure if it's ES6 modules. If you happen to experiment with this and find an answer please share. Otherwise, I can try to take a look soon. I agree that this should probably be implemented if it doesn't exist.

Agree that experimentation might be the best way to find out conclusively. Ultimately tree shaking and dead code elimination are optimisations that each build tool might implement differently, so I suspect it would be tricky to ever state conclusively that it defintely is/isn't supported.

commented

I've had this experience with create react app. I hate to say that barrelling (albeit wonderful) is awful for code splitting. As soon as you import from the barrel root, it will pull all the other dependencies with it. Creating a huge ass .js file with unneeded deps.

No activity has been seen recently, marking as stale. If this is a mistake please reach out to a collaborator