Skip to content

app.js on slow connections #1630

@khrome83

Description

@khrome83

The new version of next inlines NEXT_DATA and downloads app.js in production.

This is really nice that it is deferred and the page is usable.

The problem that I have ran into is that I have a few basic things that I need available before app.js downloads.

Is there a way to "escalate" JS code to be rendered earlier, preferably inline?

Example -

Menu Button on mobile requires JS to open.
Menu is not clickable until app.js is downloaded.

Question -

What are the ways others have solved this problem?

Concerns -
Can't use <HEAD> because that is performance negative, and is before any dom elements have been mounted. Can't get access to traditional react states, like componentDidMount.

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