feat: support pwa (#452)

* feat: support pwa

* feat: support pwa
This commit is contained in:
Xc
2023-03-10 13:25:30 +08:00
committed by GitHub
parent 7e8e15a628
commit dd91c2a4e0
5 changed files with 1868 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
import path from 'path'
import { defineConfig, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
import { VitePWA } from 'vite-plugin-pwa'
export default defineConfig((env) => {
const viteEnv = loadEnv(env.mode, process.cwd()) as unknown as ImportMetaEnv
@@ -11,7 +12,20 @@ export default defineConfig((env) => {
'@': path.resolve(process.cwd(), 'src'),
},
},
plugins: [vue()],
plugins: [
vue(),
VitePWA({
injectRegister: 'auto',
manifest: {
name: 'chatGPT',
short_name: 'chatGPT',
icons: [
{ src: 'pwa-192x192.png', sizes: '192x192', type: 'image/png' },
{ src: 'pwa-512x512.png', sizes: '512x512', type: 'image/png' },
],
},
}),
],
server: {
host: '0.0.0.0',
port: 1002,