This commit is contained in:
liangjian
2026-01-27 16:32:15 +08:00
commit 836c61ac55
303 changed files with 34442 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
import { VitePWA } from 'vite-plugin-pwa'
export const createPwa = (nodeEnv: string, pwaDev: boolean) => {
return VitePWA({
base: nodeEnv === 'development' && pwaDev ? '/' : './', // ./ 或 /
registerType: 'autoUpdate', // promp弹窗提示手动更新、autoUpdate自动更新建议使用自动更新
workbox: {
cleanupOutdatedCaches: true,
},
devOptions: {
enabled: pwaDev,
},
manifest: {
lang: 'zh',
name: 'school-apartment',
short_name: 'school-apartment',
description: '迪联科技',
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',
},
],
},
})
}