Open Psvensso opened 4 years ago
Hi @Psvensso Thank you for creating this issue.
Yes, originally this modification was introduced in regards to how web-components work. As you point out, parts of the code will need to be run before the custom elements are attached to the DOM.
However, after we introduced asynchronous loading of the web-component polyfills, there's no reason that the server bundle cannot be injected into body
instead of head
.
Thanks for pointing it out. We'll look into this and have it fixed, as soon as possible :+1:
Is your feature request related to a problem? Please describe.
We are using an external UI library, they are assuming document.body are available during eval execution. This can ofcourse be considered bad practise, i will create a bug there as well so that they null check it, but my guess is that more libs will have this problem. The root cause is that direflow injects the dev bundle into the head instead of at the end of body as for normal CRA. Is there a reason for this?
Describe the solution you'd like
1) Inject into body so direflow mimics CRA as close as possible for maximum lib compatibility. 2) Provide a config option for dev server bundle inject location.
I'm aware that this might not be possible, my knowledge of web-components are most definitely limited, perhaps the components must be defined prior to head?
Describe alternatives you've considered
Additional context