Angular 18 - Standalone Components - SSR - window is not defined - only imports
I have a Component A (Standalone), in which I import Component B. Component A does not invoke Component B in its template. Component B imports the LeafletModule and does nothing else. Both components only contain imports without any additional code, checks, or templates.
Despite only having the imports, I constantly receive this error: "window is not defined". I cannot catch or bypass this error since it occurs during the import itself. All previous methods to work around this issue are no longer viable. There must be a mechanism within this module itself that checks if "window" is available or not. If "window" is usable or if the module detects that it is running in a browser and not on a server, then the module should proceed with the initialization.
I do not believe that as developers we can continue to handle this error ourselves in Angular. The provider of the module must intervene and address this issue.