TinyJoin logoTinyJoin

tinyjoinOffline

The tinyjoinOffline function returns a Vite plugin that precaches the complete emitted production build, including lazy runtime assets, with verified content hashes. It does not register a service worker during development.

tinyjoinOffline(options?: TinyjoinOfflineOptions): Plugin
TypeDescription
options?TinyjoinOfflineOptions
returnsPlugin

The first visit requires a network connection. Wait for navigator.serviceWorker.ready before expecting a subsequent navigation to work offline. Storage persistence and application-file caching remain separate: OPFS stores the database, while the service worker stores the application.

Updates wait until all tabs controlled by the old service worker close. The plugin does not force a new worker onto running tabs. Serve the whole build together at one same-origin root-relative or relative Vite base. External requests and files created after the build are not cached.

Example

import {defineConfig} from 'vite';
import {tinyjoinOffline} from 'tinyjoin/vite';

export default defineConfig({plugins: [tinyjoinOffline()]});

Since

v0.0.6