I'm pretty sure that the issue is not Angular specific. Still I met the problem in Angular
Consider the following code
import { AfterViewInit, Component } from '@angular/core';
console.log((window as any).external_component_stuff); // <- non-empty object outputed here
debugger; // needed to see state of window.external_component_stuff object
import { ExternalComponent } from '@scope/external-component';
// component code goes here ...
Nothing can create window.external_component_stuff in other places. Why is window.external_component_stuff not undefined before import?