mirror of
https://github.com/Chanzhaoyu/chatgpt-web.git
synced 2025-07-21 03:44:21 +00:00
feat: PWA 默认不开启
This commit is contained in:
@@ -1,8 +1,28 @@
|
||||
import path from 'path'
|
||||
import type { PluginOption } from 'vite'
|
||||
import { defineConfig, loadEnv } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import { VitePWA } from 'vite-plugin-pwa'
|
||||
|
||||
function setupPlugins(env: ImportMetaEnv): PluginOption[] {
|
||||
const plugins = [vue()]
|
||||
|
||||
if (env.VITE_GLOB_APP_PWA === 'true') {
|
||||
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' },
|
||||
],
|
||||
},
|
||||
})
|
||||
}
|
||||
return plugins
|
||||
}
|
||||
|
||||
export default defineConfig((env) => {
|
||||
const viteEnv = loadEnv(env.mode, process.cwd()) as unknown as ImportMetaEnv
|
||||
|
||||
@@ -12,20 +32,7 @@ export default defineConfig((env) => {
|
||||
'@': path.resolve(process.cwd(), 'src'),
|
||||
},
|
||||
},
|
||||
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' },
|
||||
],
|
||||
},
|
||||
}),
|
||||
],
|
||||
plugins: setupPlugins(viteEnv),
|
||||
server: {
|
||||
host: '0.0.0.0',
|
||||
port: 1002,
|
||||
|
Reference in New Issue
Block a user