-1

I have updated the Angular CLI to version 11.1.2, however after successful build, I have the following error in the browser console.

I honestly can't figure out what the problem is, if anyone happened please help me.

enter image description here

rikg93
  • 1,101
  • 1
  • 11
  • 21

1 Answers1

1

If you build without optimization/minimization it will be easier to find the error. Try building and serving for development environment, not production. How you do that depends on your setup. You might have a dev and a prod script. Otherwise you can set --optimization to false (or remove it so it default to false).

The error you're seeing is because you're trying to access a property called of from a variable whose value is undefined.

Maybe searching your source code for .of will point you in the right direction. The variable before the dot should be what's causing the problem because its value is undefined. Make sure to write your code to handle the case where it is undefined.

I would recommend typescript as a good tool to use to avoid errors like this in the future. Although it's not trivial to get going for new developers, it's worth it in the long run, in my opinion.

Emanuel Lindström
  • 1,607
  • 16
  • 25