ship-gis/vite.config.ts
htlee 96ee263b1e 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

84 lines
2.0 KiB
TypeScript

import { defineConfig, loadEnv, type Plugin } from 'vite';
import react from '@vitejs/plugin-react';
export default defineConfig(({ mode, command }) => {
const env = loadEnv(mode, process.cwd(), '');
const isLocalDev = mode === 'development';
const isBuild = command === 'build';
const base = env.VITE_BASE_URL || '/';
console.log(`[Vite] Mode: ${mode}, Command: ${command}, Base: ${base}, isLocalDev: ${isLocalDev}`);
const excludePatterns: RegExp[] = isBuild && !isLocalDev
? [
/[/\\]publish[/\\]/,
/[/\\]component[/\\]wrap[/\\]/,
]
: [];
return {
base,
define: {
global: 'globalThis',
},
server: {
host: true,
port: 3000,
proxy: {
'/snp-api': {
target: env.VITE_SNP_API_TARGET || 'http://211.208.115.83:8041',
changeOrigin: true,
secure: false,
},
},
},
plugins: [
react(),
isBuild && !isLocalDev && ({
name: 'exclude-dev-folders',
resolveId(source: string) {
const normalizedSource = source.replace(/\\/g, '/');
for (const pattern of excludePatterns) {
if (pattern.test(normalizedSource)) {
return { id: 'virtual:empty-module', moduleSideEffects: false };
}
}
return null;
},
load(id: string) {
if (id === 'virtual:empty-module') {
return 'export default null;';
}
return null;
},
} satisfies Plugin),
].filter(Boolean),
resolve: {
alias: {
'@': '/src',
},
},
esbuild: isBuild && !isLocalDev
? {
drop: ['console', 'debugger'],
}
: {},
build: {
target: 'es2022',
outDir: 'dist',
cssCodeSplit: true,
rollupOptions: {
output: {
manualChunks: {
vendor: ['react', 'react-dom', 'react-router-dom'],
map: ['maplibre-gl'],
state: ['zustand'],
},
},
},
},
};
});