Tree Shaking Angular Library

Hey all, Angular libraries with Tree-Shaking question.

I’ve been reading the ng-packagr docs and it’s unclear to me, do I need to setup my public-api.ts file in a way to enable tree-shaking? For example, if I put everything in a single public-api.ts file, it seems like the user imports like this:

import { LibraryService } from 'my-library';
class UserComponent {
  constructor(foo: LibraryService) {}
}

I would assume my module needs to be imported like this to be tree shakable (Example from Material):

import {CdkTreeModule} from '@angular/cdk/tree';

It seems like what I’m looking for is a secondary entry point: https://github.com/ng-packagr/ng-packagr/blob/d6d1c088bb56fbc9093c17c0e59574db2f0ed069/docs/secondary-entrypoints.md

But in these examples, they still have a primary-entry-point public-api.ts

The docs do not mention tree-shaking though. Is the primary-entry-point still tree-shaken based on what you do/do-not use?

Update, Kevin Kreuzer answers this question in-depth here: https://medium.com/angular-in-depth/improve-spa-performance-by-splitting-your-angular-libraries-in-multiple-chunks-8c68103692d0

@erxk_verduin, can you include a quote from the article that answers your question?