title: Angular 5 AOT compilation failed
body: <p>I have an Angular 5 app that works without problems when I run it in test mode, that is, when I run the application locally using the <code>ng serve</code> command. However, when I deploy the application in production mode, that is, through the command <code>ng build --prod</code>, the application exports without problems, but when I use the application in a productive environment, this problem appears: (these are images from the browsers console from google and safari)</p>
  
  <p><strong>Google Chrome Console:</strong></p>
  
  <p><a href="https://i.stack.imgur.com/s3cgK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/s3cgK.png" alt="enter image description here"></a></p>
  
  <p><strong>Safari Console:</strong></p>
  
  <p><a href="https://i.stack.imgur.com/N89tk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/N89tk.png" alt="enter image description here"></a></p>
  
  <p><strong>However, if I now export the application using the following command <code>ng build --prod --aot false</code> the application works without any problem.</strong></p>
  
  <p>Next I am going to show the component involved in the commented error:</p>
  
  <p><strong>user-online-quote.component.html</strong></p>
  
  <pre><code>&lt;app-navbar [loggedIn]=loggedIn&gt;&lt;/app-navbar&gt;
  &lt;app-dynamic-form [answers$]="answers$"&gt;&lt;/app-dynamic-form&gt;
  </code></pre>
  
  <p><strong>user-online-quote.component.ts</strong></p>
  
  <pre><code>import { Component, OnInit } from '@angular/core';
  import { DynamicFormService } from '../_services/dynamic-form.service';
  import { RadioQuestion }  from '../shared/_shared/answer-radio';
  import { Observable } from "rxjs/Rx";
  import { AuthService } from '../_services/auth.service';
  import { Router, ActivatedRoute, Params } from '@angular/router';
  
  @Component({
    selector: 'app-user-online-quote',
    templateUrl: './user-online-quote.component.html',
    styleUrls: ['./user-online-quote.component.css'],
    providers:  [DynamicFormService, AuthService]
  })
  export class UserOnlineQuoteComponent implements OnInit {
    totalPage:number;
    actualPage:number;
    percentageCompletion:number;
    currentQuestion:string;
    selectedOption:string;
    imageSource:string;
    loggedIn:boolean;
    formId:string;
    //public answers: any[];
  
    //Signo $ porque es un observable
    public answers$: Observable&lt;any[]&gt;;
  
    constructor(private service: DynamicFormService, private authService: AuthService,
      private activatedRoute: ActivatedRoute) {
  
     }
  
    ngOnInit() {
      this.loggedIn=this.authService.isLoggedIn();
      this.activatedRoute.queryParams.subscribe((params: Params) =&gt; {
        this.formId=params['form'];
        this.answers$=this.service.getAnswers(this.formId);
      });
      //this.answers=this.service.getAnswers("CAR00PR");
      this.totalPage=4;
      this.actualPage=1;
      this.calculateAdvancePercentage();
      this.currentQuestion="¿Pregunta de prueba?";
    }
  
    calculateAdvancePercentage(){
      this.percentageCompletion=(this.actualPage/this.totalPage)*100;
    }
  
    next(){
      this.actualPage=(this.actualPage+1);
      this.calculateAdvancePercentage();
    }
  
    back(){
      this.actualPage=(this.actualPage-1);
      this.calculateAdvancePercentage();
    }
  
  }
  </code></pre>
  
  <p><strong>dinamic-form.component.html</strong></p>
  
  <pre><code>&lt;div class="space"&gt;&lt;/div&gt;
  &lt;ngx-loading [show]="loading" [config]="{ backdropBorderRadius: '0px', fullScreenBackdrop:true }"&gt;&lt;/ngx-loading&gt;
  &lt;div *ngIf="submitted===false" class="container"&gt;
    &lt;div class="row"&gt;
    &lt;div class="col-lg-2"&gt;
      &lt;div class="mx-2"&gt;&lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="col-lg-8"&gt;
      &lt;div&gt;
        &lt;p&gt;{{currentQuestion.description}}&lt;/p&gt;
      &lt;/div&gt;
      &lt;div class="progress"&gt;
        &lt;div class="progress-bar" role="progressbar" [style.width]="percentageCompletion + '%'" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"&gt;&lt;/div&gt;
      &lt;/div&gt;
        &lt;hr&gt; 
        &lt;div&gt;
          &lt;form [formGroup]="form"&gt;
            &lt;div *ngFor="let answer of answers$ | async"&gt;
              &lt;div [ngSwitch]="answer.controlType"&gt;
                &lt;div *ngSwitchCase="'radio'"&gt;
                  &lt;div class="radios checkbox-group"&gt;
                    &lt;div [hidden]="!(currentQuestion.id===answer.parent)" class="col-lg-12"&gt;
                      &lt;input [formControlName]="answer.controlName" [id]="answer.id" type="radio" [value]="answer.label" (click)="next(null,answer.child)"&gt;
                        &lt;label [for]="answer.id" class="button-label"&gt;
                          {{answer.label}}  
                        &lt;/label&gt;
                    &lt;/div&gt;
                  &lt;/div&gt;
                &lt;/div&gt;
                &lt;div *ngSwitchCase="'radio_textbox'"&gt;
                  &lt;div class="radios checkbox-group"&gt;
                    &lt;div [hidden]="!(currentQuestion.id===answer.parent)" class="col-lg-12"&gt;
                      &lt;input [formControlName]="answer.controlName" [id]="answer.id" type="radio" (click)="showTextbox ? showTextbox = false : showTextbox = true;"&gt;
                        &lt;label [for]="answer.id" class="button-label"&gt;
                          {{answer.label}}  
                        &lt;/label&gt;
                    &lt;/div&gt;
                  &lt;/div&gt;
                    &lt;div [hidden]="!(currentQuestion.id===answer.parent)" class="input-group mb-3 col-lg-12"&gt;
                      &lt;input [hidden]="!showTextbox" type="text" class="form-control" [placeholder]="answer.placeholder" [formControlName]="answer.controlName" [id]="answer.id"&gt;
                        &lt;div class="input-group-append"&gt;
                          &lt;button [hidden]="!showTextbox" class="btn btn-outline-secondary" type="button" (click)="next(null,answer.child)"&gt;Siguiente&lt;/button&gt;
                        &lt;/div&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
                &lt;div *ngSwitchCase="'file'"&gt;
                  &lt;div [hidden]="!(currentQuestion.id===answer.parent)" class="col-lg-12"&gt;
                      &lt;div class="form-group"&gt;
                          &lt;label [for]="answer.id"&gt;{{answer.label}}&lt;/label&gt;
                          &lt;div class="custom-file"&gt;
                              &lt;input [formControlName]="answer.controlName" type="file" class="custom-file-input" [id]="answer.id" lang="es" (change)="onFileChange($event)" #fileInput&gt;
                              &lt;label class="custom-file-label" for="customFileLang"&gt;{{fileName}}&lt;/label&gt;
                          &lt;/div&gt;
                          &lt;div *ngIf="answer.required===true"&gt;
                            &lt;small *ngIf="form.get(answer.controlName).status=='INVALID'" class="form-text text-muted-error"&gt;Debes tener una imagen de referencia para poder continuar&lt;/small&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                    &lt;div class="my-4"&gt;&lt;/div&gt;
                  &lt;/div&gt;
                &lt;/div&gt;    
                &lt;div *ngSwitchCase="'file_next'"&gt;
                  &lt;div [hidden]="!(currentQuestion.id===answer.parent)" class="col-lg-12"&gt;
                      &lt;div class="form-group"&gt;
                          &lt;label [for]="answer.id"&gt;{{answer.label}}&lt;/label&gt;
                          &lt;div class="custom-file"&gt;
                              &lt;input [formControlName]="answer.controlName" type="file" class="custom-file-input" [id]="answer.id" lang="es" (change)="onFileChange($event)" #fileInput&gt;
                              &lt;label class="custom-file-label" for="customFileLang"&gt;{{fileName}}&lt;/label&gt;
                          &lt;/div&gt;
                          &lt;div *ngIf="answer.required===true"&gt;
                            &lt;small *ngIf="form.get(answer.controlName).status=='INVALID'" class="form-text text-muted-error"&gt;Debes tener una imagen de referencia para poder continuar&lt;/small&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;div class="my-4"&gt;&lt;/div&gt;
                      &lt;div class="text-center"&gt;
                        &lt;button
                          (click)='next(answer.validations,answer.next)'
                          class="btn btn-outline-secondary"&gt;
                          Siguiente
                        &lt;/button&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                &lt;/div&gt;
                &lt;div *ngSwitchCase="'textbox'" [hidden]="!(currentQuestion.id===answer.parent)" class="col-md-6 mb-3"&gt;
                  &lt;label [for]="answer.id"&gt;{{answer.label}}&lt;/label&gt;
                  &lt;input [formControlName]="answer.controlName" type="text" class="form-control" [id]="answer.id" [placeholder]="answer.placeholder"&gt;
                  &lt;div *ngIf="answer.required===true"&gt;
                    &lt;small *ngIf="form.get(answer.controlName).status=='INVALID'" class="form-text text-muted-error"&gt;Este campo es obligatorio&lt;/small&gt;
                  &lt;/div&gt;
                &lt;/div&gt;
                &lt;div *ngSwitchCase="'textbox_next'" [hidden]="!(currentQuestion.id===answer.parent)"&gt;
                  &lt;div class="col-md-6 mb-3"&gt;
                    &lt;label [for]="answer.id"&gt;{{answer.label}}&lt;/label&gt;
                    &lt;input [formControlName]="answer.controlName" type="text" class="form-control" [id]="answer.id" [placeholder]="answer.placeholder"&gt;
                    &lt;div *ngIf="answer.required===true"&gt;
                      &lt;small *ngIf="form.get(answer.controlName).status=='INVALID'" class="form-text text-muted-error"&gt;Este campo es obligatorio&lt;/small&gt;
                    &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class="my-4"&gt;&lt;/div&gt;
                  &lt;div class="text-center"&gt;
                    &lt;button
                      (click)='next(answer.validations,answer.next)'
                      class="btn btn-outline-secondary"&gt;
                      Siguiente
                    &lt;/button&gt;
                  &lt;/div&gt;
                &lt;/div&gt;
                &lt;div *ngSwitchCase="'textarea'"&gt;
                  &lt;div class="form-group col-lg-12" [hidden]="!(currentQuestion.id===answer.parent)"&gt;
                    &lt;label for="description"&gt;{{answer.label}}&lt;/label&gt;
                    &lt;textarea [formControlName]="answer.controlName" class="form-control" id="description" rows="3"&gt;&lt;/textarea&gt;
                  &lt;/div&gt;
                  &lt;div class="my-4"&gt;&lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;
  
          &lt;/form&gt;
  
        &lt;/div&gt;
  
        &lt;div class="my-4"&gt;&lt;/div&gt;
        &lt;div class="text-center"&gt;
          &lt;button 
            (click)='back()' 
            class="btn btn btn-outline-secondary"&gt;
              Atrás
          &lt;/button&gt;
          &lt;button 
            [hidden]="currentQuestion.last==true"
            (click)='cancel()' 
            class="btn btn btn-outline-secondary"&gt;
              Cancelar
          &lt;/button&gt;
          &lt;button 
            [hidden]="currentQuestion.last==false"
            [disabled]="form.invalid"
            type="submit"
            class="btn btn-outline-success"
            (click)="onSubmit()"&gt;
              Enviar Solicitud
          &lt;/button&gt;
        &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="col-lg-2"&gt;
        &lt;div class="mx-2"&gt;&lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;div *ngIf="submitted==true" class="container"&gt;
    &lt;div class="space"&gt;
        &lt;div class="container"&gt;
            &lt;div class="row"&gt;
                &lt;div class="col-lg-1"&gt;&lt;/div&gt;
                &lt;div class="col-lg-10 justify"&gt;
                  &lt;p&gt;Tu solicitud se ha enviado correctamente, debes esperar un máximo de 2 días para que el experto elabore una cotización
                    de acuerdo a tus requerimientos. 
                  &lt;/p&gt;
                  &lt;div class="d-flex justify-content-center"&gt;
                    &lt;a [routerLink]="['/dashboard_usuario/negociaciones/en_proceso']"&gt;Ver negociación&lt;/a&gt;
                  &lt;/div&gt;
                &lt;/div&gt;
                &lt;div class="col-lg-1"&gt;&lt;/div&gt;
            &lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>dinamic-form.component.ts</strong></p>
  
  <pre><code>import { Component, Input, OnInit, ChangeDetectorRef }  from '@angular/core';
  import { FormGroup }                 from '@angular/forms';
  import { AnswerBase }              from '../shared/_shared/answer-base';
  import { AnswerControlService }    from '../_services/answer-control.service';
  import { DynamicFormService } from '../_services/dynamic-form.service';
  import { Question } from '../_models/question';
  import { Observable } from "rxjs/Rx"
  import { Router, ActivatedRoute, Params } from '@angular/router';
  import { QuoteDto } from "../_dtos/quoteDto";
  import { HttpClient, HttpResponse } from '@angular/common/http';
  import {Location} from '@angular/common';
  
  
  @Component({
    selector: 'app-dynamic-form',
    templateUrl: './dynamic-form.component.html',
    styleUrls: ['./dynamic-form.component.css'],
    providers: [ AnswerControlService ]
  })
  export class DynamicFormComponent implements OnInit {
    @Input() answers$: Observable&lt;AnswerBase&lt;any&gt;[]&gt;;
    form: FormGroup;
    payLoad = '';
    questionsList : Map&lt;string, Question&gt;;
    totalPage:number;
    actualPage:number;
    percentageCompletion:number;
    currentQuestion:Question;
    previousQuestion:Question;
    backwardQuestions:Array&lt;string&gt;;
    loading:boolean;
    fileName:string;
    photo:File;
    image:any;
    nextDisable:boolean;
    userId:string;
    providerId:string;
    formId:string;
    submitted:boolean;
  
  
    constructor(private qcs: AnswerControlService, 
      private dynamicFormervice: DynamicFormService,
      private activatedRoute: ActivatedRoute, 
      private location:Location,
      private router:Router) {  }
  
    ngOnInit() {
      this.loading=true;
      this.submitted=false;
      this.fileName="Seleccionar un archivo";
      this.nextDisable=true;
      this.backwardQuestions= new Array();
      this.currentQuestion=new Question('','',false);
      this.form= new FormGroup({});
      this.questionsList= new Map&lt;string, Question&gt;();
      this.activatedRoute.queryParams.subscribe((params: Params) =&gt; {
        this.userId=params['user'];
        this.providerId=params['provider'];
        this.formId=params['form'];
          this.dynamicFormervice.getTotalPages(this.formId).subscribe(total =&gt; {
            this.totalPage=total;
            this.actualPage=1;
            this.calculateAdvancePercentage();
              this.dynamicFormervice.getQuestions(this.formId).subscribe(items =&gt;{
                items.map(item =&gt;{
                  this.questionsList.set(item.id,item);
                });
              this.dynamicFormervice.getInitialQuestionId(this.formId).subscribe(id =&gt;{
                this.currentQuestion=this.questionsList.get(id);
                this.previousQuestion=this.currentQuestion;
                this.loading=false;
              });
            });
          });
      });
      this.answers$.subscribe(a=&gt;{
        this.form = this.qcs.toFormGroup(a);
      });
    }
  
    onSubmit() {
      this.loading=true;
      this.payLoad=JSON.stringify(this.form.value);
      let quote:QuoteDto = new QuoteDto();
      quote.requirements= this.payLoad;
      this.dynamicFormervice.createQuote(quote,this.userId,this.providerId).subscribe((resp:HttpResponse&lt;String&gt;)=&gt;{
        this.dynamicFormervice.uploadQuotationImage(this.photo,resp.body.substring(resp.body.indexOf(':')+1,resp.body.lastIndexOf('"'))).
        subscribe(resp =&gt; {
          this.submitted=true;
          this.loading=false;
        });
      });
    }
  
    calculateAdvancePercentage(){
      this.percentageCompletion=(this.actualPage/this.totalPage)*100;
    }
  
    next(validatios:string, childId:string){
      if(validatios!=null){
        let controlRestrictions:string[]=validatios.split(',');
        let validCount=0;
        for (let cr of controlRestrictions) {
          if(this.form.get(cr).status=='VALID'){
            validCount++;
          }
       }
       if(validCount==controlRestrictions.length){
         this.nextDisable=false;
         this.backwardQuestions.push(this.currentQuestion.id);
         this.currentQuestion=this.questionsList.get(childId);
         if(this.currentQuestion.last==true){
          this.percentageCompletion=100;
         }else{
          this.actualPage=(this.actualPage+1);
          this.calculateAdvancePercentage();
         }
       }
      }else{
        this.backwardQuestions.push(this.currentQuestion.id);
        this.currentQuestion=this.questionsList.get(childId);
        if(this.currentQuestion.last==true){
          this.percentageCompletion=100;
        }else{
         this.actualPage=(this.actualPage+1);
         this.calculateAdvancePercentage();
        }
      }
    }
  
    back(){
      if(this.actualPage==1){
        this.location.back();
      }
      else{
        let questionId:string = this.backwardQuestions.pop();
        this.currentQuestion=this.questionsList.get(questionId);
        this.actualPage=(this.actualPage-1);
        this.calculateAdvancePercentage();
      }
    }
  
    cancel(){
      this.navegateToProfessionForm();
    }
  
    navegateToProfessionForm(){
      switch (this.formId) {
        case 'ALB00PR':
          this.router.navigate(['/expertos'], { queryParams: { profession: '1' } });
          break;
        case 'CAR00PR':
          this.router.navigate(['/expertos'], { queryParams: { profession: '2' } });
          break;
        case 'DIS00PR':
          this.router.navigate(['/expertos'], { queryParams: { profession: '3' } });
          break;
        case 'ELE00PR':
          this.router.navigate(['/expertos'], { queryParams: { profession: '4' } });
          break;  
        case 'CLI00PR':
          this.router.navigate(['/expertos'], { queryParams: { profession: '5' } });
          break;
        case 'FUM00PR':
          this.router.navigate(['/expertos'], { queryParams: { profession: '6' } });
          break;
        case 'MAQ00PR':
          this.router.navigate(['/expertos'], { queryParams: { profession: '7' } });
          break;
        case 'PIN00PR':
          this.router.navigate(['/expertos'], { queryParams: { profession: '8' } });
          break;
        case 'PLO00PR':
          this.router.navigate(['/expertos'], { queryParams: { profession: '9' } });
          break;
        case 'JAR00PR':
          this.router.navigate(['/expertos'], { queryParams: { profession: '10' } });
          break;
        case 'SOL00PR':
          this.router.navigate(['/expertos'], { queryParams: { profession: '11' } });
          break;
        case 'TAP00PR':
          this.router.navigate(['/expertos'], { queryParams: { profession: '12' } });
          break;
        default:
    }
    }
  
    onFileChange(event) {
      this.loading=true;
      if(event.target.files &amp;&amp; event.target.files.length &gt; 0) {
      let image:File = event.target.files[0];
      let reader=new FileReader();
      reader.readAsDataURL(image);
        reader.onload = (event:any) =&gt; {
          let base64=event.target.result
          let filename=image.name;
          let type=image.type;
          this.reduceQuality(base64,filename,type,(file)=&gt;{
            this.photo = file;
            this.fileName=this.photo.name;
            this.loading=false;
          });
        }
      }
      else{
        this.loading=false;
      }
    }
  
    getBase64(file,callback) {
      var reader = new FileReader();
      reader.readAsDataURL(file);
      reader.onload = function() {
        let result = reader.result;
        callback(result);
      };
      reader.onerror = function (error) {
        console.log('Error: ', error);
      };
   }
  
    reduceQuality(base64Image,filename,extension,callback){
      let canvas = document.createElement('canvas');
      let ctx=canvas.getContext("2d");
      var image = new Image();
     image.onload = ()=&gt;{
      var width = image.width,
              height = image.height,
          canvas = document.createElement('canvas'),
              ctx = canvas.getContext("2d");
  
      // set proper canvas dimensions before transform &amp; export
          canvas.width = width;
        canvas.height = height;
  
          // draw image
      ctx.drawImage(image, 0, 0);
  
      let url:string = '';
      if(extension=='image/jpeg'){
        url = canvas.toDataURL('image/jpeg', 0.1);
      }
      else{
        url = canvas.toDataURL();
      }
      let file:File=this.dataURLtoFile(url,filename);
      callback(file);
    };
      image.src = base64Image;  
    }
    dataURLtoFile(dataurl, filename) {
      let arr = dataurl.split(','), mime = arr[0].match(/:(.*?);/)[1],
          bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n);
      while(n--){
          u8arr[n] = bstr.charCodeAt(n);
      }
      return new File([u8arr], filename, {type:mime});
  }
  
  }
  </code></pre>
  
  <p><strong>package.json</strong></p>
  
  <pre><code>{
    "name": "front-end",
    "version": "0.0.0",
    "license": "MIT",
    "scripts": {
      "ng": "ng",
      "start": "ng serve",
      "build": "ng build --prod",
      "test": "ng test",
      "lint": "ng lint",
      "e2e": "ng e2e"
    },
    "private": true,
    "dependencies": {
      "@angular/animations": "^5.2.0",
      "@angular/common": "^5.2.0",
      "@angular/compiler": "^5.2.0",
      "@angular/core": "^5.2.0",
      "@angular/forms": "^5.2.0",
      "@angular/http": "^5.2.0",
      "@angular/platform-browser": "^5.2.0",
      "@angular/platform-browser-dynamic": "^5.2.0",
      "@angular/router": "^5.2.0",
      "angular2-text-mask": "^8.0.4",
      "angularfire2": "^5.0.0-rc.6",
      "bootstrap": "^4.1.0",
      "core-js": "^2.4.1",
      "firebase": "^4.12.1",
      "jquery": "^3.3.1",
      "moment": "^2.20.1",
      "mydatepicker": "^2.6.3",
      "ngx-loading": "^1.0.14",
      "offcanvas-bootstrap": "^2.5.2",
      "popper.js": "^1.14.3",
      "rxjs": "^5.5.6",
      "zone.js": "0.10.3"
    },
    "devDependencies": {
      "@angular/cli": "1.6.5",
      "@angular/compiler-cli": "^5.2.0",
      "@angular/language-service": "^5.2.0",
      "@types/jasmine": "~2.8.3",
      "@types/jasminewd2": "~2.0.2",
      "@types/node": "~6.0.60",
      "codelyzer": "^4.0.1",
      "jasmine-core": "~2.8.0",
      "jasmine-spec-reporter": "~4.2.1",
      "karma": "~2.0.0",
      "karma-chrome-launcher": "~2.2.0",
      "karma-cli": "~1.0.1",
      "karma-coverage-istanbul-reporter": "^1.2.1",
      "karma-jasmine": "~1.1.0",
      "karma-jasmine-html-reporter": "^0.2.2",
      "protractor": "~5.1.2",
      "ts-node": "~4.1.0",
      "tslint": "~5.9.1",
      "typescript": "~2.5.3"
    }
  }
  </code></pre>
  
  <p><strong>angular-cli.json</strong></p>
  
  <pre><code>{
    "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
    "project": {
      "name": "front-end"
    },
    "apps": [
      {
        "root": "src",
        "outDir": "dist",
        "assets": [
          "assets",
          "favicon.ico"
        ],
        "index": "index.html",
        "main": "main.ts",
        "polyfills": "polyfills.ts",
        "test": "test.ts",
        "tsconfig": "tsconfig.app.json",
        "testTsconfig": "tsconfig.spec.json",
        "prefix": "app",
        "styles": [
          "styles-app-loading.scss",
          "styles.css",
          "../node_modules/font-awesome/css/font-awesome.css"
        ],
        "scripts": ["../node_modules/jquery/dist/jquery.slim.min.js",
          "../node_modules/popper.js/dist/umd/popper.min.js",
          "../node_modules/bootstrap/dist/js/bootstrap.min.js",
          "../node_modules/offcanvas-bootstrap/dist/js/bootstrap.offcanvas.min.js"],
        "environmentSource": "environments/environment.ts",
        "environments": {
          "dev": "environments/environment.ts",
          "prod": "environments/environment.prod.ts"
        }
      }
    ],
    "e2e": {
      "protractor": {
        "config": "./protractor.conf.js"
      }
    },
    "lint": [
      {
        "project": "src/tsconfig.app.json",
        "exclude": "**/node_modules/**"
      },
      {
        "project": "src/tsconfig.spec.json",
        "exclude": "**/node_modules/**"
      },
      {
        "project": "e2e/tsconfig.e2e.json",
        "exclude": "**/node_modules/**"
      }
    ],
    "test": {
      "karma": {
        "config": "./karma.conf.js"
      }
    },
    "defaults": {
      "styleExt": "css",
      "component": {}
    }
  
  }
  </code></pre>
  
  <p>The question is why my app only works properly when I don't use AOT feature? Why is this so strange? </p>
  
  <p>What should I do to solve this problem and I can use the AOT feature, since I do not want my application to be penalized in performance? Any ideas?</p>
  
  <p><strong><em>Important: Before separating the application by modules, the application worked well in production. The described problem appeared after separating my application by modules, however this problematic component is part of the main module.</em></strong></p>