title: Dynamic Load Component Not Work In Production
body: <p>I am using Angular 6 and  I am trying to load component dynamically by it's name 
  when user click on tab load component by name for this I am using the following code witch is working perfect on build but not work in build --production</p>
  
  <pre><code>loadTabData(tabname: any) {
      this.selectedTab = tabname;
      var factories = Array.from(this.resolver["_factories"].keys());
      var factoryClass = &lt;Type&lt;any&gt;&gt;(
        factories.find((x: any) =&gt; x.name === tabname)
      );
      let viewContainerRef = this.comLoad.viewContainerRef;
      viewContainerRef.clear();
      const factory = this.resolver.resolveComponentFactory(factoryClass);
      let componentRef = viewContainerRef.createComponent(factory);
      componentRef.instance.serviceId = this.serviceId;
    }
  </code></pre>
  
  <p>when user click on tab I load the related component in production its return the following error </p>
  
  <blockquote>
    <p>ERROR Error: No component factory found for undefined. Did you add it
    to @NgModule.entryComponents?
        at Wt (main.b98d71b6b5a909371223.js:1)
        at e.resolveComponentFactory (main.b98d71b6b5a909371223.js:1)</p>
  </blockquote>