Search code examples
angularbuilduniversal

Angular 5 build error "Property does not exist on type"


import { environment } from '../../environments/environment';
import { Headers } from '@angular/http';

@Injectable()
export class ProjectsService {

  private _wpBase = environment.wpBase;

ng build --prod gives me an error :

ERROR in src/app/projects/projects.service.ts(11,33): error TS2339: Property 'wpBase' does not exist on type '{ production: boolean; }'.

How can I fix this? The app works fine, I'm trying to implement Angular Universal using this guide: https://github.com/angular/angular-cli/wiki/stories-universal-rendering


Solution

  • You probably forgot to set the wpBase property in environment.prod.ts...

    Check both your environment.ts and environment.prod.ts and see if you have set the wpBase correctly.