'Angular 11 production fails with error: ERROR TypeError: Object(...) is not a function

Recently in my company there was an upgrade of angular app version to 11. App locally compiles and runs without a problem with ng serve, however it fails on ng serve --prod with following error:

main.js:1 ERROR TypeError: Object(...) is not a function
    at e.value (main.js:1:942704)
    at e.value (main.js:1:942493)
    at e.value (main.js:1:941765)
    at new e (main.js:1:1099073)
    at Pr (main.js:1:145982)
    at Mr (main.js:1:144712)
    at Uo (main.js:1:182147)
    at Lo (main.js:1:180936)
    at Object.ia [as createRootView] (main.js:1:190182)
    at n.value (main.js:1:136423)
bt @ main.js:1
TypeError: Object(...) is not a function
    at e.value (main.js:1:942704)
    at e.value (main.js:1:942493)
    at e.value (main.js:1:941765)
    at new e (main.js:1:1099073)
    at Pr (main.js:1:145982)
    at Mr (main.js:1:144712)
    at Uo (main.js:1:182147)
    at Lo (main.js:1:180936)
    at Object.ia [as createRootView] (main.js:1:190182)
    at n.value (main.js:1:136423)

I've tried removing rxjs-compat as suggested here. After doing that, production build completely fails, because rxjs-compat is apparently used, even though with Shift + Ctrl + F in Visual Studio nothing is found. I also tried adding rules to tslint.json as suggested here, but that didn't do aything as well. Any suggestions for debugging production code or fixing this issue are welcome.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source