-
Notifications
You must be signed in to change notification settings - Fork 29.3k
Description
Feature request
Bundling and serving of pages per user-agent.
Is your feature request related to a problem? Please describe.
Supporting legacy browsers is in most applications a necessity, but by doing so,
much functionality from modern JavaScript is not available. This limitation is
overcome by including backwards compatible implementations of such
functionality, however, this results in an unnecessary overhead for browsers
that already support the included functionality.
Describe the solution you'd like
By serving bundled pages per user-agent, the overhead is no longer a problem and
the average response time of page requests (and the evaluation time of
JavaScript) will become shorter, thereby providing a better user experience.
The (simplified) implementation of this feature comes down to user-agent
specific routing in the Next.js handler and a browser-specific Babel preset
configuration. As for hot reloading, the user-agent is simply also used to
target a specific configuration.
Bundling for multiple browsers may be parallelized and shouldn't impact the
total bundling time much.
Describe alternatives you've considered
Alternatively, the functionality of this feature may also be possible by
starting x
number of Next.js handles for each browser (by configuration) and
have a custom server redirect the user-agent to the proper handle.