96 lines
2.4 KiB
TypeScript
96 lines
2.4 KiB
TypeScript
import { fileURLToPath, URL } from 'node:url'
|
|
|
|
import { defineConfig } from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
import vueDevTools from 'vite-plugin-vue-devtools'
|
|
import { VitePWA } from 'vite-plugin-pwa'
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
base: '/',
|
|
server: {
|
|
host: '0.0.0.0',
|
|
allowedHosts: ['humetrain.me', '*.humetrain.me'],
|
|
hmr: {
|
|
host: 'humetrain.me',
|
|
clientPort: 443,
|
|
},
|
|
proxy: {
|
|
'/api': {
|
|
target: 'http://localhost:8080',
|
|
changeOrigin: true,
|
|
},
|
|
'/auth': {
|
|
target: 'http://localhost:8080',
|
|
changeOrigin: true,
|
|
},
|
|
},
|
|
},
|
|
plugins: [
|
|
vue(),
|
|
vueDevTools(),
|
|
VitePWA({
|
|
strategies: 'generateSW',
|
|
registerType: 'autoUpdate',
|
|
injectRegister: 'auto',
|
|
workbox: {
|
|
globPatterns: ['**/*.{js,css,html,ico,svg}'],
|
|
navigateFallback: 'index.html',
|
|
// 런타임 캐싱 (API 응답 캐시)
|
|
runtimeCaching: [
|
|
{
|
|
urlPattern: /^\/api\/.*/,
|
|
handler: 'NetworkFirst',
|
|
options: {
|
|
cacheName: 'api-cache',
|
|
expiration: {
|
|
maxEntries: 50,
|
|
maxAgeSeconds: 60 * 60 * 24 // 24시간
|
|
}
|
|
}
|
|
},
|
|
{
|
|
urlPattern: /^https:\/\/humetrain\.me\/api\/.*/,
|
|
handler: 'NetworkFirst',
|
|
options: {
|
|
cacheName: 'api-cache',
|
|
expiration: {
|
|
maxEntries: 50,
|
|
maxAgeSeconds: 60 * 60 * 24
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
manifest: {
|
|
name: '1호선 고장코드',
|
|
short_name: '고장코드',
|
|
description: '철도 차량 고장코드 및 TCMS 신호 조회 애플리케이션',
|
|
theme_color: '#0F172A',
|
|
background_color: '#0F172A',
|
|
display: 'standalone',
|
|
orientation: 'portrait',
|
|
scope: '/',
|
|
start_url: '/',
|
|
icons: [
|
|
{
|
|
src: 'icons/icon-192.svg',
|
|
sizes: '192x192',
|
|
type: 'image/svg+xml',
|
|
},
|
|
{
|
|
src: 'icons/icon-512.svg',
|
|
sizes: '512x512',
|
|
type: 'image/svg+xml',
|
|
},
|
|
],
|
|
},
|
|
}),
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
'@': fileURLToPath(new URL('./src', import.meta.url))
|
|
},
|
|
},
|
|
})
|