-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[Feature request] Config option to disable prefetch links, or only prefetch certain pages #636
Comments
For request 1, we have supported, see: shouldPrefetch. For request 2, Since VuePress's |
Thanks. Really weird caching issue or something on the page you linked to there... at first the |
That's the issue of service worker, make sure you have closed all the previous vuepress website tabs before opening this link. BTW, we'll have a update popup UI in the future: #533 |
Just a note that the documentation on By the way, to anyone coming across this, I have several hundred individual markdown files in my glossary of terms and turning prefetch off dramatically increased load time, obviously. I would look forward to a way to setup some sort of background caching of these resources using the serviceworker instead, but that would be a separate feature request. |
Now in https://ssr.vuejs.org/api/#shouldprefetch shouldPrefetch: (file, type) => {
// type is inferred based on the file extension.
// https://fetch.spec.whatwg.org/#concept-request-destination
if (type === 'script' || type === 'style') {
return true
}
if (type === 'font') {
// only preload woff2 fonts
return /\.woff2$/.test(file)
}
if (type === 'image') {
// only preload important images
return file === 'hero.jpg'
} |
Feature request
What problem does this feature solve?
Sites with many pages don't want to prefetch all pages. For example, a site with 1,000+ pages may want to prefetch no pages, or a small selection of main pages.
What does the proposed API look like?
In
.vuepress/config.js
add an optionprefetch
which defaults totrue
but can be changed tofalse
to not prefetch any pages, or an array of pages.How should this be implemented in your opinion?
Are you willing to work on this yourself?**
The text was updated successfully, but these errors were encountered: