this boilerplate is designed for enabling PWA (with offline functionality) in basic Svelte template
install rollup-plugin-workbox
npm install --save rollup-plugin-workbox
add this lines to the top of rollup.config.js:
import { injectManifest } from 'rollup-plugin-workbox';
const workboxConfig = require('./public/workbox-config.js')
add this to plugins section in rollup.config.js:
injectManifest(workboxConfig)
add files from 'public' directory to your project`s 'public' directory (replace 'index.html')
main rules for caching are written in workbox-config.js file