$service-worker
import { const base: stringThe base path of the deployment. Typically this is equivalent to config.kit.paths.base, but it is calculated from location.pathname meaning that it will continue to work correctly if the site is deployed to a subdirectory.
Note that there is a base but no assets, since service workers cannot be used if config.kit.paths.assets is specified.
base, const build: string[]An array of URL strings representing the files generated by Vite, suitable for caching with cache.addAll(build).
During development, this is an empty array.
build, const files: string[]An array of URL strings representing the files in your static directory, or whatever directory is specified by config.kit.files.assets. You can customize which files are included from static directory using config.kit.serviceWorker.files
files, const prerendered: string[]An array of pathnames corresponding to prerendered pages and endpoints.
During development, this is an empty array.
prerendered, const version: stringSee config.kit.version. It’s useful for generating unique cache names inside your service worker, so that a later deployment of your app can invalidate old caches.
version } from '$service-worker';Ce module est uniquement disponible pour les service workers.
base
Le chemin base du déploiement. Typiquement, ceci est équivalent à config.kit.paths.base, mais
est calculé depuis location.pathname, ce qui signifie qu’il va continuer de fonctionner
correctement si le site est déployé depuis un sous-dossier.
Notez qu’il y a une base mais pas d’assets, puisque les service workers ne peuvent pas être
utilisés si config.kit.paths.assets est défini.
const base: string;build
Un tableau de chaînes de caractères d’URL représentant les fichiers générés par Vite, adaptés à la
mise en cache avec cache.addAll(build).
Lors du développement, ce tableau est vide.
const build: string[];files
Un tableau de chaînes de caractères d’URL représentant les fichiers dans votre dossier static, ou
dans n’importe quel dossier défini par config.kit.files.assets. Vous pouvez personnaliser les
fichiers à inclure dans le dossier static en utilisant
config.kit.serviceWorker.files.
const files: string[];prerendered
Un tableau de chemins correspondant aux pages pré-rendues et endpoints. Lors du développement, ce tableau est vide.
const prerendered: string[];version
Voir config.kit.version. Ce champ est utile pour générer des
noms de mise en cache uniques au sein de votre service worker, afin qu’un déploiement ultérieur de
votre application puisse invalider les vieux caches.
const version: string;Modifier cette page sur Github llms.txt