Uncaught TypeError: Cannot read property 'id' of undefined at registerNgModuleType - angular PWA
This often happens when you've mixed up imports
and declarations
in the pertinent module (or some other such mix-up). You might for example have put a component in the imports
array, where only modules should be 'declared'. The component should be in the declarations
array.
In my case this error occurred seemingly at random. One moment it was working, and the next moment it wasn't. Known working commits were also broken.
I had to delete node_modules
and reinstall them which fixed the problem.
This could happen when you have imported a wrong module inside imports
array in module also. One time when working with a reactive forms, I had mistakenly added FormBuilder
inside imports rather than ReactiveFormsModule
and it gave me the similar error.
Looks like this error could come from multiple reasons.