2026-02-15 10:28:27 +09:00
|
|
|
import { defineConfig, loadEnv, type Plugin } from 'vite';
|
2026-01-30 13:01:54 +09:00
|
|
|
import react from '@vitejs/plugin-react';
|
|
|
|
|
|
2026-02-15 11:37:37 +09:00
|
|
|
export default defineConfig(({ mode, command }) => {
|
2026-01-30 13:01:54 +09:00
|
|
|
const env = loadEnv(mode, process.cwd(), '');
|
|
|
|
|
|
2026-02-05 06:35:31 +09:00
|
|
|
const isLocalDev = mode === 'development';
|
|
|
|
|
const isBuild = command === 'build';
|
|
|
|
|
|
2026-02-12 13:54:21 +09:00
|
|
|
const base = env.VITE_BASE_URL || '/';
|
2026-02-05 06:35:31 +09:00
|
|
|
|
|
|
|
|
console.log(`[Vite] Mode: ${mode}, Command: ${command}, Base: ${base}, isLocalDev: ${isLocalDev}`);
|
|
|
|
|
|
2026-02-15 10:28:27 +09:00
|
|
|
const excludePatterns: RegExp[] = isBuild && !isLocalDev
|
2026-02-05 06:35:31 +09:00
|
|
|
? [
|
|
|
|
|
/[/\\]publish[/\\]/,
|
|
|
|
|
/[/\\]component[/\\]wrap[/\\]/,
|
|
|
|
|
]
|
|
|
|
|
: [];
|
|
|
|
|
|
2026-02-15 11:37:37 +09:00
|
|
|
return {
|
2026-02-05 06:35:31 +09:00
|
|
|
base,
|
|
|
|
|
define: {
|
2026-02-15 10:28:27 +09:00
|
|
|
global: 'globalThis',
|
2026-02-05 06:35:31 +09:00
|
|
|
},
|
2026-01-30 13:01:54 +09:00
|
|
|
server: {
|
|
|
|
|
host: true,
|
|
|
|
|
port: 3000,
|
|
|
|
|
proxy: {
|
2026-02-15 07:02:22 +09:00
|
|
|
'/snp-api': {
|
|
|
|
|
target: env.VITE_SNP_API_TARGET || 'http://211.208.115.83:8041',
|
2026-01-30 13:01:54 +09:00
|
|
|
changeOrigin: true,
|
|
|
|
|
secure: false,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
2026-02-05 06:35:31 +09:00
|
|
|
plugins: [
|
|
|
|
|
react(),
|
2026-02-15 10:28:27 +09:00
|
|
|
isBuild && !isLocalDev && ({
|
2026-02-05 06:35:31 +09:00
|
|
|
name: 'exclude-dev-folders',
|
2026-02-15 10:28:27 +09:00
|
|
|
resolveId(source: string) {
|
2026-02-05 06:35:31 +09:00
|
|
|
const normalizedSource = source.replace(/\\/g, '/');
|
|
|
|
|
for (const pattern of excludePatterns) {
|
|
|
|
|
if (pattern.test(normalizedSource)) {
|
|
|
|
|
return { id: 'virtual:empty-module', moduleSideEffects: false };
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
},
|
2026-02-15 10:28:27 +09:00
|
|
|
load(id: string) {
|
2026-02-05 06:35:31 +09:00
|
|
|
if (id === 'virtual:empty-module') {
|
|
|
|
|
return 'export default null;';
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
},
|
2026-02-15 10:28:27 +09:00
|
|
|
} satisfies Plugin),
|
2026-02-05 06:35:31 +09:00
|
|
|
].filter(Boolean),
|
2026-01-30 13:01:54 +09:00
|
|
|
resolve: {
|
|
|
|
|
alias: {
|
|
|
|
|
'@': '/src',
|
|
|
|
|
},
|
|
|
|
|
},
|
2026-02-05 06:35:31 +09:00
|
|
|
esbuild: isBuild && !isLocalDev
|
|
|
|
|
? {
|
|
|
|
|
drop: ['console', 'debugger'],
|
|
|
|
|
}
|
|
|
|
|
: {},
|
2026-01-30 13:01:54 +09:00
|
|
|
build: {
|
2026-02-15 11:37:37 +09:00
|
|
|
target: 'es2022',
|
2026-01-30 13:01:54 +09:00
|
|
|
outDir: 'dist',
|
|
|
|
|
cssCodeSplit: true,
|
|
|
|
|
rollupOptions: {
|
|
|
|
|
output: {
|
|
|
|
|
manualChunks: {
|
|
|
|
|
vendor: ['react', 'react-dom', 'react-router-dom'],
|
refactor: OpenLayers → MapLibre GL JS 코어 전환 (Session C)
메인 지도 엔진을 OpenLayers에서 MapLibre GL JS 5.18.0으로 전환.
Deck.gl 통합을 수동 캔버스 오버레이에서 @deck.gl/mapbox MapboxOverlay로 단순화.
주요 변경:
- maplibregl.Map + MapboxOverlay(자동 뷰 동기화) 기반 재구성
- OL EPSG:3857 좌표 변환 → MapLibre LngLat(4326) 직접 사용
- 줌 규약: mapStore.zoom = OL 규약 유지 (MapLibre zoom + 1)
- OL 전용 코드에 MapLibre 가드 패턴 적용 (getCanvas 체크)
- 커서 관리: default → pointer(호버) → grabbing(드래그)
신규: projection.ts | 재작성: baseLayer, useShipLayer, MapContainer, useTrackingMode
패치: mapStore, shipLayer, TopBar, useShipSearch, useRealmLayer, useMeasure,
useZoneDraw, useZoneEdit, ReplayWebSocketService, TrackQueryViewer 외
미동작(후속 세션): 측정(F), 관심구역(E), 반경원(E), 구역편집(G), 미니맵(H)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 12:49:08 +09:00
|
|
|
map: ['maplibre-gl'],
|
2026-01-30 13:01:54 +09:00
|
|
|
state: ['zustand'],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
2026-02-15 11:37:37 +09:00
|
|
|
};
|
|
|
|
|
});
|