Kometa UI is an Angular 22 component kit. Up to 0.1.x it was published the way the Angular CLI scaffolds a library: one public-api.ts that re-exports everything, built by ng-packagr into one package entry. In 0.2.0 every source file became its own secondary entry point, 85 of them. This post covers why, what the layout looks like, and the one rule that makes it build.
The problem: lazy routes paying for the initial chunk
The app I extracted the kit from has an admin area with lazy-loaded routes. Most kit components are only used inside those routes. You would expect each component's code to load with its route.
It did not. ng-packagr builds each entry point into a single flat ES module. With one entry, that is one module containing every component. Tree-shaking removes the components nobody imports, but it does not split the rest: a bundler places a module's code in one chunk.…