Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can we implement prefetching not using Service Worker? #522

Closed
irrigator opened this issue Dec 26, 2016 · 3 comments
Closed

Can we implement prefetching not using Service Worker? #522

irrigator opened this issue Dec 26, 2016 · 3 comments

Comments

@irrigator
Copy link

First of all, thanks for creating such an amazing tool! Next.js seems like a "dream framework" to me for building web apps, which "brings us the best of both worlds" (single page app and server side rendering).

To me the most important piece that helps Next.js fullfil its promise is the ability to prefetch all the components that the tags point to in a page.

According to the documentation this feature is implemented using Service Worker, a API that only supports Chrome and Firefox. This means a great portion of web users just can't take advantage of this great feature. I don't know if I miss something.

Can we implement prefetching using other kinds of techniques, which support all modern browsers, instead of using Service Worker?

@arunoda
Copy link
Contributor

arunoda commented Dec 26, 2016

This means a great portion of web users just can't take advantage of this great feature

This is kind a untrue. See: http://caniuse.com/#feat=serviceworkers
Browsers are going into this direction and will catch up soon.

Anyway, our current focus is shipping 2.0 and the current prefetching solution is pretty neat for that.
If someone could work on this suggestion, I think we have no reason to say no.
(And it's totally possible to do it in the userland as well)

@sedubois
Copy link
Contributor

I noted here some ideas to broaden the support, namely using AppCache: #24 (comment)

@rauchg
Copy link
Member

rauchg commented Dec 28, 2016

A principle that has served us well over the years is to provide support for all browsers, but optimizations for modern ones.

Prefetching is an optimization. To invest more and more code into an optimization that will be deprecated (since all modern user agents support ServiceWorker or plan to do so) doesn't seem like a good area of focus.

If you want, feel free to create your own userland prefetching module that exposes the same API as next/prefetch. The neat thing is: if you don't use next/prefetch, it won't make it into the build. No bloat :)

@rauchg rauchg closed this as completed Dec 28, 2016
@lock lock bot locked as resolved and limited conversation to collaborators May 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants