title: Cannot read property 'moduleType' of undefined during ng build --prod
body: <p>I am at the finishing point and I am trying to upload my application to production. I ran the ng build --prod command and I only got one warning message saying:</p>
  
  <pre><code> "WARNING in Circular dependency detected:
  src\app\app.module.ts -&gt; src\app\app.module.ngfactory.js -&gt;             src\app\app.module.ts" 
  </code></pre>
  
  <p>It seems like it is just a warning, but it might be the cause of this error I am not too sure; the main error that I get my in application is:</p>
  
  <pre><code> main-es2015.39c9ec206581527dd6ff.js:1 Uncaught TypeError: Cannot read property 'moduleType' of undefined
  </code></pre>
  
  <p>This is only in the production build and in my local it works perfect. I have it setup in IIS server. </p>
  
  <p>I read a post that angular doesn't give you all the errors and to run this command and it will give you the error message. I ran it and I did have some errors which I was able to fix. </p>
  
  <pre><code>./node_modules/.bin/ngc
  </code></pre>
  
  <p>I am almost there... Any help would be greatly appreciated and please let me know if there are any other data or files I can upload to help pin-point the error.</p>
  
  <p>Not sure if this would be helpful:</p>
  
  <pre><code>import { BrowserModule } from '@angular/platform-browser';
  import { NgModule } from '@angular/core';
  import { HttpClientModule } from '@angular/common/http';
  import { AppRoutingModule } from './app-routing.module';
  import { AppComponent } from './app.component';
  import { TaskComponent } from './task/task.component';
  import { HeaderComponent } from './header/header.component';
  import { FooterComponent } from './footer/footer.component';
  //services 
  import {TaskService} from './task.service';
  import {AuthService} from './auth.service';
  
  //material design 
  import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
  
  //reactive forms
  import { FormsModule, ReactiveFormsModule } from '@angular/forms';
  import { MatPasswordStrengthModule } from '@angular-material-extensions/password-strength';
  import { MatAutocompleteModule } from '@angular/material/autocomplete';
  import { MatBadgeModule } from '@angular/material/badge';
  import { MatButtonModule } from '@angular/material/button';
  import { MatCardModule } from '@angular/material/card';
  import { MatCheckboxModule } from '@angular/material/checkbox';
  import { MatDialogModule } from '@angular/material/dialog';
  import { MatExpansionModule } from '@angular/material/expansion';
  import { MatFormFieldModule } from '@angular/material/form-field';
  import { MatGridListModule } from '@angular/material/grid-list';
  import { MatIconModule } from '@angular/material/icon';
  import { MatInputModule } from '@angular/material/input';
  import { MatListModule } from '@angular/material/list';
  import { MatMenuModule } from '@angular/material/menu';
  import { MatPaginatorModule } from '@angular/material/paginator';
  import { MatProgressBarModule } from '@angular/material/progress-bar';
  import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
  import { MatSelectModule } from '@angular/material/select';
  import { MatSidenavModule } from '@angular/material/sidenav';
  import { MatSlideToggleModule } from '@angular/material/slide-toggle';
  import { MatSnackBarModule } from '@angular/material/snack-bar';
  import { MatSortModule } from '@angular/material/sort';
  import { MatStepperModule } from '@angular/material/stepper';
  import { MatTableModule } from '@angular/material/table';
  import { MatTabsModule } from '@angular/material/tabs';
  import { MatToolbarModule } from '@angular/material/toolbar';
  import { MatTooltipModule } from '@angular/material/tooltip';
  import { MatTreeModule } from '@angular/material/tree';
  import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
  import { UpdateTaskComponent } from './update-task/update-task.component';
  import { CreateTaskComponent } from './create-task/create-task.component';
  import { RegisterComponent } from './register/register.component';
  import { LoginComponent } from './login/login.component';
  import { UpdateRecipientComponent } from './update-recipient/update-recipient.component';
  import { CreateNewUserComponent } from './create-new-user/create-new-user.component';
  import { SidenavService } from './sidenav.service';
  import { ManageUsersComponent } from './manage-users/manage-users.component';
  import { UpdateUserComponent } from './update-user/update-user.component';
  import { ConfirmationDialogComponent } from './confirmation-dialog/confirmation-dialog.component';
  import { TabDirective } from './ReuseableFunctions/tab-directive';
  import { MyReportsGridComponent } from './my-reports-grid/my-reports-grid.component';
  import { PageNotFoundComponent } from './page-not-found/page-not-found.component';
  import { CdkDetailsRowDirective } from './cdk-details-row.directive';
  
  
  @NgModule({
    declarations: [
      AppComponent,
      CdkDetailsRowDirective,
      TaskComponent,
      HeaderComponent,
      FooterComponent,
      UpdateTaskComponent,
      CreateTaskComponent,
      RegisterComponent,
      LoginComponent,
      UpdateRecipientComponent,
      CreateNewUserComponent,
      ManageUsersComponent,
      UpdateUserComponent,
      ConfirmationDialogComponent,
      TabDirective,
      MyReportsGridComponent,
      PageNotFoundComponent
    ],
    imports: [
      BrowserModule,
      AppRoutingModule,
      MatButtonModule,
      MatCheckboxModule,
      MatInputModule,
      MatPaginatorModule,
      MatProgressSpinnerModule,
      MatSortModule,
      MatTableModule,
      MatCardModule,
      MatListModule,
      MatToolbarModule,
      MatIconModule,
      MatSidenavModule,
      MatBadgeModule,
      MatTooltipModule,
      MatSelectModule,
      MatDialogModule,
      HttpClientModule,
      BrowserAnimationsModule,
      FormsModule,
      ReactiveFormsModule,
      MatTreeModule,
      MatFormFieldModule,
      MatSlideToggleModule,
      MatAutocompleteModule,
      MatTabsModule,
      MatExpansionModule,
      MatSnackBarModule,
      MatStepperModule,
      MatPasswordStrengthModule,
  
      MatGridListModule,
      MatProgressBarModule,
      MatMenuModule
    ],
    entryComponents: [UpdateTaskComponent, UpdateRecipientComponent, UpdateUserComponent, ConfirmationDialogComponent],
    providers: [TaskService,AuthService, SidenavService, HeaderComponent],
    bootstrap: [AppComponent]
  })
  export class AppModule { }
  platformBrowserDynamic().bootstrapModule(AppModule);
  </code></pre>