123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- import { VitePWA, VitePWAOptions } from 'vite-plugin-pwa'
- const pwaOptions: Partial<VitePWAOptions> = {
- base: './',
- registerType: 'autoUpdate', // prompt、autoUpdate
- workbox: {
- cleanupOutdatedCaches: true,
- },
- manifest: {
- lang: 'zh',
- name: 'Vue Shop Vite',
- short_name: 'Vue Shop Vite',
- description: 'Vue Shop Vite官网、文档、演示地址',
- background_color: '#ffffff',
- 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',
- purpose: 'any',
- },
- {
- src: 'maskable-icon-512x512.png',
- sizes: '512x512',
- type: 'image/png',
- purpose: 'maskable',
- },
- ],
- },
- }
- export const createPwa = () => {
- return VitePWA(pwaOptions)
- }
|