redfin / react-server

:rocket: Blazing fast page load and seamless navigation.
https://react-server.io/
Apache License 2.0
3.89k stars 184 forks source link

Scripts common.[hash].js and PageName.[hash].js are rendered synchronously #952

Open sofiia-hlyniana opened 6 years ago

sofiia-hlyniana commented 6 years ago

JS bundles neither have async attribute nor load asynchronously using LABjs. I've tested my App with Google Audit and it definitely shows that these bundle scripts are blocking render, so the page can't be rendered until the browser loads them. 1

gigabo commented 6 years ago

Hi @sofiia-hlyniana sorry you're running into trouble.

This is a surprising finding to me. One solution you might try is the jsBelowTheFold option, which may be set on the return value from handleRoute.

class Page {
    handleRoute() {
        return {code: 200, jsBelowTheFold: true};
    }
}

Beyond that if you'd like the requests to be started above the fold you could look into adding support for an async attribute on the script tags produced our copy of LABjs.