Georgi Parlakov
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:

  1. Angular compiler creates factory functions for any component we've decided on our module.
  2. 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
  3. In theory the unused factories should drop on tree shake
  4. 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

--

--

Georgi Parlakov
Georgi Parlakov

Written by Georgi Parlakov

Angular and DotNet dev. RxJs explorer. Testing proponent. A dad. Educative.io course author. https://gparlakov.github.io/

No responses yet