title: conditionally add a library in and angular2 in app.module.ts
body: <p>I want to conditionally add a library in and angular2 in my app.module.ts by ENV..if production add if not dont add.  How? Below is what I want to do but does not work
  E.g.</p>
  
  <pre><code>import { environment } from '../environments/environment';
  import * as Raven from 'raven-js';
  Raven
    .config(environment.sentry)
    .install();
  
  export class RavenErrorHandler implements ErrorHandler {
    handleError(err:any) : void {
      Raven.captureException(err.originalError || err);
    }
  }
  
  @NgModule({
    declarations: [...]
    providers: [
         if (environment=='production'){
              { provide: ErrorHandler, useClass: RavenErrorHandler },
         }
    ],
    bootstrap: [AppComponent]
    })
    export class AppModule { }    
  </code></pre>