vite-pwa
Version:
This package helps you to cache your files with service worker.
26 lines (25 loc) • 925 B
JavaScript
// CommonJs module feature
import{fileURLToPath as ______file___URL___To___Path______}from'url';
let __filename=______file___URL___To___Path______(import.meta.url);
let __dirname=______file___URL___To___Path______(new URL('.',import.meta.url));
import path from 'path';
export const defaultConfig = {
swDest: 'sw',
swRegisterDest: 'swRegister',
mapDest: 'mappings',
map: false,
spa: true,
preCacheSw: true,
preCacheFiles: [],
preCacheFilter: null,
preCacheName: 'pre-cache',
runtimeCacheName: 'runtime-cache',
};
export const name = 'Vite-PWA';
export const swInputFile = path.join(__dirname, '../../assets/sw.js');
export const swRegisterInputFile = path.join(__dirname, '../../assets/swRegister.js');
export const getRandomRef = () => {
return `// ${Math.random().toString(35) +
Math.random().toString(35) +
Math.random().toString(36)}`;
};