Skip to content

Commit

Permalink
fix(projects): fix vite-pwa plugin config
Browse files Browse the repository at this point in the history
  • Loading branch information
honghuangdc committed Nov 14, 2022
1 parent 436b15f commit 94098d0
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
6 changes: 3 additions & 3 deletions build/plugins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import type { PluginOption } from 'vite';
import vue from '@vitejs/plugin-vue';
import vueJsx from '@vitejs/plugin-vue-jsx';
import unocss from '@unocss/vite';
import { VitePWA } from 'vite-plugin-pwa';
import progress from 'vite-plugin-progress';
import routerPage from '@soybeanjs/router-page';
import html from './html';
import unplugin from './unplugin';
import mock from './mock';
import visualizer from './visualizer';
import compress from './compress';
import pwa from './pwa';

/**
* vite插件
Expand All @@ -19,13 +19,13 @@ export function setupVitePlugins(viteEnv: ImportMetaEnv): (PluginOption | Plugin
const plugins = [
vue(),
vueJsx(),
VitePWA(),
html(viteEnv),
...unplugin(viteEnv),
unocss(),
mock,
progress(),
routerPage()
routerPage(),
pwa()
];

if (viteEnv.VITE_VISUALIZER === 'Y') {
Expand Down
31 changes: 31 additions & 0 deletions build/plugins/pwa.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { VitePWA } from 'vite-plugin-pwa';

export default function setupVitePwa() {
return VitePWA({
registerType: 'autoUpdate',
includeAssets: ['favicon.ico'],
manifest: {
name: 'SoybeanAdmin',
short_name: 'SoybeanAdmin',
theme_color: '#fff',
icons: [
{
src: '/logo.png',
sizes: '192x192',
type: 'image/png'
},
{
src: '/logo.png',
sizes: '512x512',
type: 'image/png'
},
{
src: '/logo.png',
sizes: '512x512',
type: 'image/png',
purpose: 'any maskable'
}
]
}
});
}
Binary file added public/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

1 comment on commit 94098d0

@vercel
Copy link

@vercel vercel bot commented on 94098d0 Nov 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.