I have an HTML page, which making get request to the react page hosted in other domain. Once, i get page response, i copy JS from head section of requested page to head section of my page and same for script available in body section.
Requested page is an react page which contain react and react-dom in head section and other JS chunk in body section, which will get copy to same section on my page.
I thought, any script copied to head section of page immediately block page execution and once all script in head get executed then only scrip in body will execute.
I'm getting intermittent client side error of "ReactDOM is not defined". It seems script copied to body is getting executed before script in head is fully executed.
ReactJS and ReactDOM JS is in head section of page and chunk which throwing error is in body.
external "ReactDOM":1 Uncaught ReferenceError: ReactDOM is not defined
at Object.faye (external "ReactDOM":1)
at f (bootstrap:83)
at Module.7n5H (tes1.ts:18)
at f (bootstrap:83)
at Object.0 (test2.ts:114)
at f (bootstrap:83)
at t (bootstrap:45)
at Array.r [as push] (bootstrap:32)
at 0.9efbe0e7cdf36824.chunk.js?_=1555361723703:1 faye @ external "ReactDOM":1 f @ bootstrap:83 7n5H @ tes1.ts:18 f @ bootstrap:83 0 @ test2.ts:114 f @ bootstrap:83 t @ bootstrap:45 r @ bootstrap:32 (anonymous) @ 0.9efbe0e7cdf36824.chunk.js?_=1555361723703:1