60 lines
1.3 KiB
TypeScript
60 lines
1.3 KiB
TypeScript
import { defineConfig } from 'vite';
|
|
import react from '@vitejs/plugin-react-swc';
|
|
import { fileURLToPath, URL } from 'node:url';
|
|
import { VitePWA } from 'vite-plugin-pwa';
|
|
|
|
const pwaManifest = {
|
|
name: 'Traveling Around The World',
|
|
short_name: 'Travel Map',
|
|
description: '記錄旅程、管理旅遊分類並在地圖上標記足跡的 PWA。',
|
|
lang: 'zh-Hant',
|
|
start_url: '/',
|
|
scope: '/',
|
|
display: 'standalone',
|
|
background_color: '#ffffff',
|
|
theme_color: '#0f172a',
|
|
icons: [
|
|
{
|
|
src: '/icons/icon-192.svg',
|
|
sizes: '192x192',
|
|
type: 'image/svg+xml',
|
|
purpose: 'any'
|
|
},
|
|
{
|
|
src: '/icons/icon-512.svg',
|
|
sizes: '512x512',
|
|
type: 'image/svg+xml',
|
|
purpose: 'any maskable'
|
|
}
|
|
]
|
|
};
|
|
|
|
export default defineConfig({
|
|
plugins: [
|
|
react(),
|
|
VitePWA({
|
|
registerType: 'autoUpdate',
|
|
includeAssets: ['favicon.svg', 'icons/icon-192.svg', 'icons/icon-512.svg'],
|
|
manifest: pwaManifest,
|
|
workbox: {
|
|
navigateFallback: '/index.html',
|
|
globPatterns: ['**/*.{js,css,html,svg,png,ico,json}']
|
|
}
|
|
})
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
'@shared': fileURLToPath(new URL('../shared', import.meta.url))
|
|
}
|
|
},
|
|
server: {
|
|
port: 5173,
|
|
proxy: {
|
|
'/api': {
|
|
target: 'http://localhost:4000',
|
|
changeOrigin: true
|
|
}
|
|
}
|
|
}
|
|
});
|