Open Rich-Harris opened 6 years ago
We could also prefetch but not parse JS until needed.
What I'm doing with my project is downloading only the files needed for the current page. Then on link hover, I prefetch that href'
s assets.
As of 0.8, preloading secondary routes no longer happens automatically, but via a preloadRoutes
function. So I'll close this — explicit user control is always the best way
Relevant article, if we were ever to decide to do predictive prefetching based on user behaviour http://blog.mgechev.com/2018/03/18/machine-learning-data-driven-bundling-webpack-javascript-markov-chain-angular-react/
@ansarizafar found this video, which appears to be covering the same stuff as the blog post — leaving it here as a reference https://www.youtube.com/watch?v=L5tPWCB7jX0&feature=youtu.be
At present, Sapper prefetches all code-split chunks in no particular order. It could do better. In increasing order of difficulty:
Also, in some cases it'd make sense not to prefetch at all.