Open FranckFreiburger opened 6 years ago
FYI shouldPreload
has the same parameters as shouldPrefetch
: https://ssr.vuejs.org/en/api.html#shouldpreload
I also need to prefetch only files related to the current user's langage.
User's langage is stored (server-side) in the application i18n.locale.
shouldPrefetch()
should also expose the application that is currently server-side rendering (or at least its context).
ping !
Agree. file
param of shouldPrefetch
and shouldPreload
are too hard to use.
I'm a user of vuepress, it make's me very difficult to decide which pages to prefetch while number of pages growing fast. Although with this option provided, but it's just like a simple boolean value: 'prefetch everything' or 'prefetch nothing'.
Hopefuly there will be any enhencements. Thanks!
What problem does this feature solve?
Currently, I use
import(/* webpackChunkName: "lang-[request]" */ json!yaml!./myForm.lang.${currentLocale}.yaml)
to load the appropriate translation for my components.This generates
numberOfForms * numberOfLangages
chunks that are prefetched when the application starts.I would like to load only translations for the current language.
shouldPrefetch(file, type)
givesThere is not enough information to filter files that should not been prefetched.
What does the proposed API look like?
I don't know what are the available information at
shouldPrefetch
. But probably API should look like:shouldPrefetch(file, type, originalFilename)