I looked here on StackOverflow and other sites and nothing I've seen or tried seems to help, so I'm throwing this out here.
When I do a simple build ng b everything runs fine. When I build our application using ng b --prod --aot=true and then run it I get the following exception:
ERROR TypeError: Object(...) is not a function
at CG.getAPIURLs (main.f5019b5d20f499feb949.js:1)
at new Ou (main.f5019b5d20f499feb949.js:1)
at Sn (main.f5019b5d20f499feb949.js:1)
at xn (main.f5019b5d20f499feb949.js:1)
at Cr (main.f5019b5d20f499feb949.js:1)
at br (main.f5019b5d20f499feb949.js:1)
at Object.Rr [as createRootView] (main.f5019b5d20f499feb949.js:1)
at Kl.create (main.f5019b5d20f499feb949.js:1)
at gt.create (main.f5019b5d20f499feb949.js:1)
at Di.bootstrap (main.f5019b5d20f499feb949.js:1)
ee @ main.f5019b5d20f499feb949.js:1
I'm running Angular Version 9 as follows:
Angular CLI: 9.1.7
Node: 16.10.0
OS: win32 x64
Angular: 9.1.9
... animations, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, router
Ivy Workspace: No
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.901.7
@angular-devkit/build-angular 0.901.7
@angular-devkit/build-optimizer 0.901.7
@angular-devkit/build-webpack 0.901.7
@angular-devkit/core 9.1.7
@angular-devkit/schematics 9.1.7
@angular/cli 9.1.7
@angular/http 7.2.16
@ngtools/webpack 9.1.7
@schematics/angular 9.1.7
@schematics/update 0.901.7
rxjs 6.5.5
typescript 3.7.5
webpack 4.42.0
The code is as follows:
import { APIURLType } from './types/apiurl.type';
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from '../../../node_modules/rxjs/Observable';
import { of } from '../../../node_modules/rxjs/Observable/of';
import { environment } from './../../environments/environment';
@Injectable()
export class APIPathService {
public aPIPathURLs: APIURLType;
public kind = 'nothing';
public environmentAPI: APIURLType = environment;
constructor(public httpClient: HttpClient) {
console.log('APIPathURL.service.ts');
} // ends constructor
getAPIURLs(): Observable<APIURLType> {
console.log('Environment API: ' + this.environmentAPI.rootPath);
return of(this.environmentAPI);
} // ends getAPIURLs
} // ends class APIPathService
I'm wondering if I should upgraded everything as I'm out of ideas. Any clues would be most appreciated.
Tim