Vue-router: Feature Request - Route preloading

Created on 14 Dec 2016  路  3Comments  路  Source: vuejs/vue-router

It would be great to be able to preload routes in the background while a user is browsing the app. This would mean less chance of there being a delay when a new route is navigated to that the user has not already visited.

This seems to be something the Angular 2 router has, there is a description of how they approach it here: https://vsavkin.com/angular-router-preloading-modules-ba3c75e424cb#.r9f68uyhs

Most helpful comment

Hi, thanks for filling this issue. Preloading should indeed be useful, though I think it's better handled by module bundlers (webpack/browserify/rollup etc.) in a framework agnostic approach, or a separate library that works on top of those build systems, rather than being implemented by each framework all over again.

Currently, with webpack and chrome, you can already achieve it with <link rel="preload" src=".."/>. You can check out the guide here: https://medium.com/@addyosmani/progressive-web-apps-with-react-js-part-2-page-load-performance-33b932d97cf2#.iq9o9six5#8fb3 under the Bonus: Preload those routes! section.

All 3 comments

Hi, thanks for filling this issue. Preloading should indeed be useful, though I think it's better handled by module bundlers (webpack/browserify/rollup etc.) in a framework agnostic approach, or a separate library that works on top of those build systems, rather than being implemented by each framework all over again.

Currently, with webpack and chrome, you can already achieve it with <link rel="preload" src=".."/>. You can check out the guide here: https://medium.com/@addyosmani/progressive-web-apps-with-react-js-part-2-page-load-performance-33b932d97cf2#.iq9o9six5#8fb3 under the Bonus: Preload those routes! section.

Thanks for the reply, I'll have to wait and see what happens in the future.

+1 This feature is very useful!
The article has detailed info that includes:

At the time of writing, preload is only implemented in Chrome, but can be treated as a progressive enhancement for browsers that do support it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Atinux picture Atinux  路  3Comments

onlyfew picture onlyfew  路  3Comments

shinygang picture shinygang  路  3Comments

rr326 picture rr326  路  3Comments

saman picture saman  路  3Comments