import {defineConfig} from 'vite' import react from '@vitejs/plugin-react' import {fileURLToPath, URL} from 'node:url'; import {VitePWA} from 'vite-plugin-pwa' // https://vite.dev/config/ export default defineConfig({ plugins: [ react(), VitePWA({ registerType: 'autoUpdate', manifest: { name: 'AI Language Chat', short_name: 'AI Lang', description: 'Chat with AI to learn foreign languages', start_url: '/', scope: '/', display: 'standalone', background_color: '#ffffff', theme_color: '#2563EB', icons: [ { src: '/android-chrome-192x192.png', sizes: '192x192', type: 'image/png' }, { src: '/android-chrome-512x512.png', sizes: '512x512', type: 'image/png' }, { src: '/android-chrome-512x512.png', sizes: '512x512', type: 'image/png', purpose: 'any maskable' } ] } }) ], resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)), } }, server: { host: '0.0.0.0', port: 5223, strictPort: true //如果端口被占直接报错,不自动换 } })