UNPKG

@vite-pwa/create-pwa

Version:
63 lines (61 loc) 1.77 kB
import { defineConfig } from 'vite' import solid from 'vite-plugin-solid' import { VitePWA } from 'vite-plugin-pwa' export default defineConfig({ plugins: [ solid(), VitePWA({ strategies: 'generateSW', // when using strategies 'injectManifest' you need to provide the srcDir // srcDir: 'src', // when using strategies 'injectManifest' use claims-sw.ts or prompt-sw.ts // filename: 'prompt-sw.ts', registerType: 'prompt', injectRegister: false, pwaAssets: { disabled: false, config: true, htmlPreset: '2023', overrideManifestIcons: true }, manifest: { name: 'Vite PWA + Solid + TS', short_name: 'Vite PWA', theme_color: '#ffffff', icons: [ { src: 'pwa-64x64.png', sizes: '64x64', type: 'image/png', }, { src: 'pwa-192x192.png', sizes: '192x192', type: 'image/png', }, { src: 'pwa-512x512.png', sizes: '512x512', type: 'image/png', }, { src: 'maskable-icon-512x512.png', sizes: '512x512', type: 'image/png', purpose: 'maskable', }, ], }, workbox: { globPatterns: ['**/*.{js,css,html,svg,png,svg,ico}'], cleanupOutdatedCaches: true, clientsClaim: true, }, injectManifest: { globPatterns: ['**/*.{js,css,html,svg,png,svg,ico}'], }, devOptions: { enabled: false, navigateFallback: 'index.html', suppressWarnings: true, /* when using generateSW the PWA plugin will switch to classic */ type: 'module', }, }) ], })