title: Function calls are not supported in decorators while ng build --prod (AOT)
body: <p>Type of Issue: Bug / Question</p>
  
  <p>Description</p>
  
  <p>I'm using ng-packagr lib to compile my library to js. I've compiled everything without any problems, but when I'll want to consume my library with ng build --prod (AOT enabled), I'm getting error:</p>
  
  <p><code>
  ERROR in Error during template compile of 'AppModule' Function calls are not supported in decorators but 'BsDropdownModule' was called.
  </code></p>
  
  <p>When I remove .forRoot method, I'm getting error:</p>
  
  <p><code>
  ERROR in : Unexpected value 'BsDropdownModule in /home/sf/Desktop/Developerka/kompilacja/final/sample-repo/node_modules/angular-library-name/free/dropdown/dropdown.module.d.ts' imported by the module 'AppModule in /home/sf/Desktop/Developerka/kompilacja/final/sample-repo/src/app/app.module.ts'. Please add a @NgModule annotation
  </code></p>
  
  <p>Please note, that <code>ng --prod --aot=false</code>
  is not producing any errors.</p>
  
  <p>How To Reproduce:</p>
  
  <p>Download repo: <a href="https://github.com/Bloodcast69/aot-error" rel="noreferrer">https://github.com/Bloodcast69/aot-error</a> , type <code>
  npm install
  ng build --prod.
  </code></p>
  
  <p>Expected Behaviour</p>
  
  <p>Want to build with AOT without errors (I need this to be compatible with Angular Universal)
  Version Information</p>
  
  <p><code>
  ng-packagr: 2.4.1
  @angular/*: 5.2.9
  typescript: 2.5.3
  rxjs: 5.5.6
  node: 8.1.0
  npm/yarn: npm: 5.6.0
  </code></p>
  
  <p>Files:</p>
  
  <p>app.module.ts:</p>
  
  <pre><code>import { BsDropdownModule } from 'angular-library-name';
  import { BrowserModule } from '@angular/platform-browser';
  import { NgModule } from '@angular/core';
  
  
  
  import { AppComponent } from './app.component';
  
  
  @NgModule({
    declarations: [
      AppComponent
    ],
    imports: [
      BsDropdownModule.forRoot(),
      BrowserModule
    ],
    providers: [],
    bootstrap: [AppComponent]
  })
  export class AppModule { }
  </code></pre>
  
  <p>dropdown.module.d.ts:</p>
  
  <pre><code>import { ModuleWithProviders } from '@angular/core';
  export declare class BsDropdownModule {
      static forRoot(config?: any): ModuleWithProviders;
  }
  </code></pre>
  
  <p>dropdown.module.ts (before compilation to JS):</p>
  
  <pre><code>import { ModuleWithProviders, NgModule } from '@angular/core';
  import { ComponentLoaderFactory } from '../utils/component-loader/index';
  
  import { PositioningService } from '../utils/positioning/index';
  import { BsDropdownContainerComponent } from './dropdown-container.component';
  import { BsDropdownMenuDirective } from './dropdown-menu.directive';
  import { BsDropdownToggleDirective } from './dropdown-toggle.directive';
  import { BsDropdownConfig } from './dropdown.config';
  
  import { BsDropdownDirective } from './dropdown.directive';
  import { BsDropdownState } from './dropdown.state';
  
  @NgModule({
    declarations: [
    BsDropdownMenuDirective,
    BsDropdownToggleDirective,
    BsDropdownContainerComponent,
    BsDropdownDirective
    ],
    exports: [
    BsDropdownMenuDirective,
    BsDropdownToggleDirective,
    BsDropdownDirective
    ],
    entryComponents: [BsDropdownContainerComponent]
  })
  export class BsDropdownModule {
    public static forRoot(config?: any): ModuleWithProviders {
      return {
        ngModule: BsDropdownModule, providers: [
        ComponentLoaderFactory,
        PositioningService,
        BsDropdownState,
        {provide: BsDropdownConfig, useValue: config ? config : {autoClose: true}}
        ]
      };
    };
  }
  </code></pre>
  
  <p><strong>NOTE</strong>
  I've read whole Internet to find something which would be helpful to me, but without any success. I've checked this topics:</p>
  
  <p><a href="https://stackoverflow.com/questions/47686638/featuremodule-fails-during-an-aot-build-when-static-forroot-has-arguments">FeatureModule fails during an AOT build when static forRoot has arguments</a></p>
  
  <p><a href="https://github.com/angular/angular/issues/14707" rel="noreferrer">https://github.com/angular/angular/issues/14707</a></p>
  
  <p>If there's missing some needed informations, please let me know, and I'll provide it.</p>
  
  <p>Thanks,
  Bloodcast69</p>