Angular Build - Uncaught TypeError: Cannot read property 'id' of undefined

enter image description here

If you go in the devtools and click on Sources, "Don't pause on exceptions" and check "Pause on caught expecptions" and continue until you get the "id error" you will find what module the error is thrown. In my case was a third party library called 'ngx-card/ngx-card' and it's module was the cause of the error (CardModule). Hope this will help find at least the cause of the error

enter image description here


I managed to solve the problem by disabling ivy in the angular compilation options. As soon as i did that it worked building both dev and production versions and is now working perfectly within Nginx.

Thanks to everyone who offered help :)


In tsconfig.json of your Angular project, put this to disable Ivy, the new Angular template engine

{
  ...
  "angularCompilerOptions": {
    "enableIvy": false
  }
}