I have recently migrated a project to Angular 17 and standalone components. As part of this I removed all ngModules.
However I have barrel files (index.ts) files remaining at all levels of my feature and shared folders (which previously had 1-1 relationships with ngModules).
For example. A barrel file in my ‘ui’ folder will export all components in there individually and then the barrel file in the parent folder will export * from ‘.ui’.
This means that I can then import a component just as ‘…from @shared’ or ‘…from @organizations’. However I’d do the same thing for a service or directive as they too woudl be rolled up into the single parent barrel for that feature.
My initial chunks seem bloated (which I had befor the migration) and I can see ui components being pulled in at startup that are not used at that point in the application. My concern is that by referencing the ‘broad’ barrel files I’m interfering with tree-shaking.
Is this a real concern, and what is best practice with angular, standalone components and barrel files?