ship-gis/vite.config.ts
htlee 6e3ad9e0d8 chore: JavaScript → TypeScript 전환 완료 (77개 파일)
JS/JSX 77개 파일을 TS/TSX로 전환하고 JS 원본을 삭제.
- stores 7개, map core 6개, hooks 4개 등 전체 모듈 전환
- TypeScript strict 모드, OL/Deck.gl 타입 적용
- .gitignore에서 TS/TSX 무시 규칙 제거
- pre-commit hook: .js,.jsx → .ts,.tsx 확장자 변경
- tsc --noEmit 0 에러, ESLint 0 에러, yarn build 성공

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 10:28:27 +09:00

83 lines
2.0 KiB
TypeScript

import { defineConfig, loadEnv, type Plugin } from 'vite';
import react from '@vitejs/plugin-react';
export default ({ mode, command }: { mode: string; command: string }) => {
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 defineConfig({
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: {
outDir: 'dist',
cssCodeSplit: true,
rollupOptions: {
output: {
manualChunks: {
vendor: ['react', 'react-dom', 'react-router-dom'],
map: ['ol', 'ol-ext'],
state: ['zustand'],
},
},
},
},
});
};