@@@@@@
This commit is contained in:
46
library/build/pwa/index.ts
Normal file
46
library/build/pwa/index.ts
Normal 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',
|
||||
},
|
||||
],
|
||||
},
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user