feat: support pwa (#452)

* feat: support pwa

* feat: support pwa
main
Xc 2 years ago committed by GitHub
parent 7e8e15a628
commit dd91c2a4e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -58,6 +58,7 @@
"tailwindcss": "^3.2.7", "tailwindcss": "^3.2.7",
"typescript": "~4.9.5", "typescript": "~4.9.5",
"vite": "^4.1.4", "vite": "^4.1.4",
"vite-plugin-pwa": "^0.14.4",
"vue-tsc": "^1.2.0" "vue-tsc": "^1.2.0"
}, },
"lint-staged": { "lint-staged": {

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

@ -1,6 +1,7 @@
import path from 'path' import path from 'path'
import { defineConfig, loadEnv } from 'vite' import { defineConfig, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue' import vue from '@vitejs/plugin-vue'
import { VitePWA } from 'vite-plugin-pwa'
export default defineConfig((env) => { export default defineConfig((env) => {
const viteEnv = loadEnv(env.mode, process.cwd()) as unknown as ImportMetaEnv const viteEnv = loadEnv(env.mode, process.cwd()) as unknown as ImportMetaEnv
@ -11,7 +12,20 @@ export default defineConfig((env) => {
'@': path.resolve(process.cwd(), 'src'), '@': 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: { server: {
host: '0.0.0.0', host: '0.0.0.0',
port: 1002, port: 1002,

Loading…
Cancel
Save