1 min readMay 29, 2019
Hey. You got me with your question. I think in theory, and assuming ahead of time build it should. In practice I've seen the opposite. Here's how I explain that to myself:
- Angular compiler creates factory functions for any component we've decided on our module.
- We import the module, so the module 'host'(importing) can see the 'guest'(imported) components' factory functions and use them to build it's own declarad components
- In theory the unused factories should drop on tree shake
- In my practice I've seen the exact opposite. Admittedly that's with an older version - angular 5 - of the compiler. Also `ng build --help` states that the --prod build does limited treeshaking.
I'll definitely look into this and get back. Thanks for that question