title: Angular 5: Function calls are not supported in decorators
body: <p>I am building a PWA from my Angular app and I am getting the following error when I run <code>ng build --prod</code>:</p>
  
  <pre><code>ERROR in app\app.module.ts(108,64): Error during template compile of 'AppModule'
  Function calls are not supported in decorators but 'Environment' was called in 'environment'
  'environment' calls 'Environment'.
  </code></pre>
  
  <p>However, it makes no sense because I added <code>export</code> to the class as you can see here:</p>
  
  <p><strong>environment.prod.ts</strong></p>
  
  <pre><code>import { BaseEnvironment } from './base-environment';
  import { ProspectBuilderModel } from '../app/models/prospect';
  
  export class Environment extends BaseEnvironment {
    production: boolean = true;
    prospectBuilderModel: ProspectBuilderModel = {
      buildQuote: false,
      buildAcknowledge: false,
      buildOrganizationInfo: false,
      buildFinancialInfo: false,
      buildTradeInfo: false,
      buildPermissiblePurpose: false,
      buildUserSetup: false,
      buildPackageSelection: false,
      buildPaymentOptions: false,
      buildOrderOptions: false,
      buildVerifyOrganizationInfo: false,
      buildDocusignAuthorization: false,
      buildDocusignContract: false
    };
  }
  
  export const environment = new Environment();
  </code></pre>
  
  <p><strong>base-environment.ts</strong></p>
  
  <pre><code>import { ProspectBuilderModel } from '../app/models/prospect';
  
  export abstract class BaseEnvironment {
    abstract production: boolean;
    abstract prospectBuilderModel: ProspectBuilderModel;
  }
  </code></pre>
  
  <p><strong>app.module.ts</strong></p>
  
  <pre><code>...
   ],
    imports: [
      BrowserModule,
      AppRoutingModule,
      FormsModule,
      MultiselectDropdownModule,
      ReactiveFormsModule,
      HttpModule,
      ToastrModule.forRoot(),
      BrowserAnimationsModule,
      NgxMyDatePickerModule.forRoot(),
      PopoverModule.forRoot(),
      ModalModule.forRoot(),
      ServiceWorkerModule.register('/ngsw-worker.js', { enabled: environment.production })
    ],
    providers: [
  ...
  </code></pre>
  
  <p>Does anyone know what I can do to resolve this error?</p>