You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Suggestion: add 2 bundles for legacy and modern browsers #7263
It'd be awesome if you make an option while building react app an option that makes a script determines whether this is a legacy browser or modern one so the script can deliver the right bundle to the client
It'd be much faster for modern browsers
Hi @yousefelgoharyx, of course this is possible - but generally it requires something server side.
If you'd like to take a look into a client-only solution or propose an approach, we'd definitely love to hear it. I agree that it would be great to ship the smallest bundle to every client.
A server side solution is better in this case though.
A client side solution would be possible with a small inlined script in the index.html that injected the correct script tag. However that would not allow the browser to find the script tag with the preparser and start fetching it, before it can execute JavaScript. This makes the experience worse for everyone, though modern browsers would probably regain that loss with the more efficient bundle.
A serverside solution that falls back to serving the legacy (current) bundle if not configured would solve that problem and with good documentation examples it would be easy for people to opt in to the more optimised bundle.
Activity
mrmckeb commentedon Jun 23, 2019
Hi @yousefelgoharyx, of course this is possible - but generally it requires something server side.
If you'd like to take a look into a client-only solution or propose an approach, we'd definitely love to hear it. I agree that it would be great to ship the smallest bundle to every client.
Pajn commentedon Jun 25, 2019
A server side solution is better in this case though.
A client side solution would be possible with a small inlined script in the index.html that injected the correct script tag. However that would not allow the browser to find the script tag with the preparser and start fetching it, before it can execute JavaScript. This makes the experience worse for everyone, though modern browsers would probably regain that loss with the more efficient bundle.
A serverside solution that falls back to serving the legacy (current) bundle if not configured would solve that problem and with good documentation examples it would be easy for people to opt in to the more optimised bundle.
iansu commentedon Jun 25, 2019
This is something we've previously discussed and have done some work on: #4964
I'm going to close this as a duplicate.