Skip to content

Commit dd91c2a

Browse files
authoredMar 10, 2023
feat: support pwa (Chanzhaoyu#452)
* feat: support pwa * feat: support pwa
1 parent 7e8e15a commit dd91c2a

File tree

5 files changed

+1962
-95
lines changed

5 files changed

+1962
-95
lines changed
 

‎package.json

+1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
"tailwindcss": "^3.2.7",
5959
"typescript": "~4.9.5",
6060
"vite": "^4.1.4",
61+
"vite-plugin-pwa": "^0.14.4",
6162
"vue-tsc": "^1.2.0"
6263
},
6364
"lint-staged": {

‎pnpm-lock.yaml

+1,946-94
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎public/pwa-192x192.png

7.19 KB
Loading

‎public/pwa-512x512.png

33.6 KB
Loading

‎vite.config.ts

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import path from 'path'
22
import { defineConfig, loadEnv } from 'vite'
33
import vue from '@vitejs/plugin-vue'
4+
import { VitePWA } from 'vite-plugin-pwa'
45

56
export default defineConfig((env) => {
67
const viteEnv = loadEnv(env.mode, process.cwd()) as unknown as ImportMetaEnv
@@ -11,7 +12,20 @@ export default defineConfig((env) => {
1112
'@': path.resolve(process.cwd(), 'src'),
1213
},
1314
},
14-
plugins: [vue()],
15+
plugins: [
16+
vue(),
17+
VitePWA({
18+
injectRegister: 'auto',
19+
manifest: {
20+
name: 'chatGPT',
21+
short_name: 'chatGPT',
22+
icons: [
23+
{ src: 'pwa-192x192.png', sizes: '192x192', type: 'image/png' },
24+
{ src: 'pwa-512x512.png', sizes: '512x512', type: 'image/png' },
25+
],
26+
},
27+
}),
28+
],
1529
server: {
1630
host: '0.0.0.0',
1731
port: 1002,

0 commit comments

Comments
 (0)
Please sign in to comment.