import { resolve } from "node:path"; import { fileURLToPath } from "node:url"; const __dirname = fileURLToPath(new URL(".", import.meta.url)); /** * Vite 설정 — 임도 설계 웹앱 (Vanilla TS + Three.js) * * - root: A00_Common (index.html 위치) * - 페이지 폴더(A01_Home 등)는 ../를 통해 접근 * - 0_old(구형 코드), venv(파이썬)는 빌드에서 제외 */ export default { root: "A00_Common", publicDir: false, cacheDir: "config/node_modules/.vite", resolve: { alias: { "@ui": resolve(__dirname, "./ui_template"), "@config": resolve(__dirname, "./config"), "@util": resolve(__dirname, "./common_util"), three: resolve(__dirname, "./config/node_modules/three"), "maplibre-gl": resolve(__dirname, "./config/node_modules/maplibre-gl"), // WebCAD(B07) — GPL 컨버터는 스텁으로 차단, MIT 패키지만 실제 번들 "@mlightcad/dxf-json-converter": resolve(__dirname, "./config/config_cad_gpl_stub.ts"), "@mlightcad/libredwg-converter": resolve(__dirname, "./config/config_cad_gpl_stub.ts"), "@mlightcad/cad-simple-viewer": resolve( __dirname, "./config/node_modules/@mlightcad/cad-simple-viewer", ), "@mlightcad/data-model": resolve(__dirname, "./config/node_modules/@mlightcad/data-model"), "lodash-es": resolve(__dirname, "./config/node_modules/lodash-es"), }, }, server: { port: 5173, open: false, // 백엔드(FastAPI) 프록시 — config_frontend.ts의 API_BASE_URL과 정합 proxy: { "/api": { target: "http://localhost:8000", changeOrigin: true, }, // WebCAD 전체 앱 (B07 iframe) — FastAPI 정적 마운트로 위임 "/cadviewer": { target: "http://localhost:8000", changeOrigin: true, }, }, }, build: { outDir: "../config/node_modules/.build", emptyOutDir: true, target: "es2022", }, optimizeDeps: { exclude: ["0_old"], }, };