mirror of
https://github.com/vbenjs/vben-admin-thin-next.git
synced 2025-01-23 17:50:22 +08:00
35 lines
789 B
TypeScript
35 lines
789 B
TypeScript
/**
|
|
* Zero-config PWA for Vite
|
|
* https://github.com/antfu/vite-plugin-pwa
|
|
*/
|
|
|
|
import { VitePWA } from 'vite-plugin-pwa';
|
|
|
|
export function configPwaConfig(env: ViteEnv) {
|
|
const { VITE_USE_PWA, VITE_GLOB_APP_TITLE, VITE_GLOB_APP_SHORT_NAME } = env;
|
|
|
|
if (VITE_USE_PWA) {
|
|
// vite-plugin-pwa
|
|
const pwaPlugin = VitePWA({
|
|
manifest: {
|
|
name: VITE_GLOB_APP_TITLE,
|
|
short_name: VITE_GLOB_APP_SHORT_NAME,
|
|
icons: [
|
|
{
|
|
src: './resource/img/pwa-192x192.png',
|
|
sizes: '192x192',
|
|
type: 'image/png',
|
|
},
|
|
{
|
|
src: './resource/img/pwa-512x512.png',
|
|
sizes: '512x512',
|
|
type: 'image/png',
|
|
},
|
|
],
|
|
},
|
|
});
|
|
return pwaPlugin;
|
|
}
|
|
return [];
|
|
}
|