ng build throws rxjs switchmap error
scry-UrjitDesai opened this issue · comments
Hey, I am trying to build my project using ng build but am getting the following error:
An unhandled exception occurred: (0 , rxjs_1.switchMap) is not a function
I am using import.meta.env everywhere.
Here is my env.d.ts
interface ImportMeta {
readonly env: ImportMetaEnv;
}
interface ImportMetaEnv {
/**
* Built-in environment variable.
* @see Docs https://github.com/chihab/ngx-env#ng_app_env.
*/
readonly NG_APP_ENV: string;
// Add your environment variables below
// readonly NG_APP_API_URL: string;
[key: string]: any;
}
declare namespace NodeJS {
export interface ProcessEnv {
readonly NG_APP_ENV: string;
// Add your environment variables below
[key: string]: any;
}
}
rxjs version- 6.5.5
I also tried using process.env instead of import.meta
It is still giving me the same error. I was able to get rid of the error by upgrading the rxjs package to >7.0 but I would still like to know if there is any other solution apart from this.
Thanks !
It would be nice to have a repo reproducing the issue.
Closing the issue. Feel free to re-open the issue with a reproducing project (preferrably on stackblitz).
I had the same problem and solved it downgrading the @ngx-env/builder version to 15.1.0, since my Angular version is 14.
Check your Angular version and find a lib version that uses the same Angular version.
Yes, can confirm. v16 throws error like OP posted, while v15 works. I have pretty old angular + rxjs repo, maybe can build a repro later.