How to create a dynamic component in angular 6 when prod mode is on

I had a requirement where i was creating a dynamic componnent using angular5. I had writtena directive which generated a component. It worked fine in dev/prod mode both. But on upgrading the app to angular6 it doesnt work as in prod mode when AOT is "ON", the compiler class is unavailable. how can i re-design my soln so as it works in angular6 ?

export class HtmlOutletDirective implements OnChanges {
@Input() html: string;
constructor(private vcRef: ViewContainerRef, private compiler: Compiler, 
private translate: TranslateService) {
}

ngOnChanges() {
const html = this.html;
if (!html) { return; }

@Component({
  selector: 'ccw-dynamic-component',
  template: `
    <div [innerHtml]="innerHtmlTemplate">
    </div>
    `
})

class DynamicHtmlComponent {
  private innerHtmlTemplate: any = '';
  constructor(private httpClient: HttpClient, private sanitizer: DomSanitizer) {
    this.httpClient.get(html, { responseType: 'text' }).subscribe((htmlContent) => {
      this.innerHtmlTemplate = sanitizer.bypassSecurityTrustHtml(htmlContent.toString());
    });
  }
}

@NgModule({
  imports: [CommonModule],
  declarations: [DynamicHtmlComponent]
})

class DynamicHtmlModule { }

this.compiler.compileModuleAndAllComponentsAsync(DynamicHtmlModule)
  .then(factory => {
    const compFactory = factory.componentFactories.find(x => x.componentType === DynamicHtmlComponent);
    const compRef = this.vcRef.createComponent(compFactory, 0);
  });
 }

I call my directive like this in my component:

   <mat-accordion [multi]="true">
        <mat-expansion-panel *ngFor='let releaseNote of releaseNotes'>
            <mat-panel-description>
                <dcHtmlOutlet [html]="releaseNote.html"></dcHtmlOutlet>
            </mat-panel-description>
        </mat-expansion-panel>
    </mat-accordion>

Below is the error i get:

 Runtime compiler is not loaded Error stack trace: Error: Runtime compiler is not loaded at Le (main.00612d315fe86075b5fb.js:1) at t.compileModuleAndAllComponentsAsync