-
Notifications
You must be signed in to change notification settings - Fork 14
Description
Would be cool to have something like this for preloading support
https://github.com/spaansba/ForesightJS
From their readme:
ForesightJS is designed for developers who want to squeeze every drop of performance out of their web applications. It's a specialized tool, not something to drop into every project.
Note that it says "not something to drop into every project".
On the other hand I think NextJS might prefetch everything linked to by <Link> by default (when the <Link> enters the viewport). Please double check though.
We should decide if we always want ForesightJS loaded, or if it should be opt-in. And if we load it, should we attach it to all <Link>s, or maybe just <NavLink>, or maybe just links on the main homepage, or just link at the to of every page, etc etc.
Maybe we should have a prefetch prop people can add to links where they want it, and if no prefetch is detected anywhere we don't even load Foresight, to reduce the bundle size. Lots of options. Lots of decisions to make! I'm also wary about extra code to maintain and one more 3rd party dependency to worry about.