2022-12-18 02:29:16 +03:00
|
|
|
import type { VitePWANuxtOptions } from '../modules/pwa/types'
|
2024-09-30 11:11:56 +03:00
|
|
|
import { isCI, isDevelopment } from 'std-env'
|
2022-12-18 02:29:16 +03:00
|
|
|
|
2022-12-28 17:08:03 +03:00
|
|
|
export const pwa: VitePWANuxtOptions = {
|
2022-12-18 02:29:16 +03:00
|
|
|
mode: isCI ? 'production' : 'development',
|
2022-12-21 03:06:51 +03:00
|
|
|
// disable PWA only when in preview mode
|
2022-12-22 16:48:20 +03:00
|
|
|
disable: /* temporarily test in CI isPreview || */ (isDevelopment && process.env.VITE_DEV_PWA !== 'true'),
|
2022-12-18 02:29:16 +03:00
|
|
|
scope: '/',
|
|
|
|
srcDir: './service-worker',
|
2024-09-23 15:45:46 +03:00
|
|
|
filename: 'elk-sw.ts',
|
2022-12-18 02:29:16 +03:00
|
|
|
strategies: 'injectManifest',
|
|
|
|
injectRegister: false,
|
|
|
|
includeManifestIcons: false,
|
2023-01-06 15:48:43 +03:00
|
|
|
manifest: false,
|
2022-12-18 02:29:16 +03:00
|
|
|
injectManifest: {
|
2023-01-17 13:42:42 +03:00
|
|
|
globPatterns: ['**/*.{js,json,css,html,txt,svg,png,ico,webp,woff,woff2,ttf,eot,otf,wasm}'],
|
2023-12-20 21:54:40 +03:00
|
|
|
globIgnores: ['emojis/**', 'manifest**.webmanifest'],
|
2022-12-18 02:29:16 +03:00
|
|
|
},
|
|
|
|
devOptions: {
|
|
|
|
enabled: process.env.VITE_DEV_PWA === 'true',
|
|
|
|
type: 'module',
|
|
|
|
},
|
|
|
|
}
|