| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- import type { Options as PwaPluginOptions } from 'vite-plugin-pwa';
- import type { ImportmapPluginOptions } from './typing';
- const isDevelopment = process.env.NODE_ENV === 'development';
- const getDefaultPwaOptions = (name: string): Partial<PwaPluginOptions> => ({
- manifest: {
- description:
- 'Vue Vben Admin is a modern admin dashboard template based on Vue 3. ',
- icons: [
- {
- sizes: '192x192',
- src: 'https://cdn.jsdelivr.net/npm/@vbenjs/static-source@0.1.3/source/pwa-icon-192.png',
- type: 'image/png',
- },
- {
- sizes: '512x512',
- src: 'https://cdn.jsdelivr.net/npm/@vbenjs/static-source@0.1.3/source/pwa-icon-512.png',
- type: 'image/png',
- },
- ],
- name: `${name}o${isDevelopment ? ' dev' : ''}`,
- short_name: `${name}${isDevelopment ? ' dev' : ''}`,
- },
- });
- const defaultImportmapOptions: ImportmapPluginOptions = {
- // 通过 Importmap CDN 方式引入,
- // 目前只有esm.sh源兼容性好一点,jspm.io对于 esm 入口要求高
- defaultProvider: 'esm.sh',
- importmap: [
- { name: 'vue' },
- { name: 'pinia' },
- { name: 'vue-router' },
- { name: 'vue-i18n' },
- { name: 'dayjs' },
- { name: 'vue-demi' },
- ],
- };
- export { defaultImportmapOptions, getDefaultPwaOptions };
|