Skip to content

[Feature Request/Discussion] Bundling and serving per user-agent #4754

@martinjlowm

Description

@martinjlowm

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions