import { defineConfig } from "vite"; import vue from "@vitejs/plugin-vue"; import { resolve } from "path"; import ElementPlus from "unplugin-element-plus/vite"; let app = "criminal"; if (process.argv.length > 3) { app = process.argv[process.argv.length - 1].trim(); } const dev = true; export default defineConfig({ define: { VITE_APP_APP: JSON.stringify(app), }, base: "./", build: { outDir: `dist/${app}`, }, resolve: { alias: [ { find: "@", replacement: resolve(__dirname, "./src"), }, ], }, css: { preprocessorOptions: { scss: { additionalData: `@use "@/app/${app}/useStyle.scss" as *;`, }, }, }, plugins: [ vue(), ElementPlus({ useSource: true, }), ], server: { port: 5173, host: "0.0.0.0", proxy: { "/api": { target: dev ? "http://test-mix3d.4dkankan.com" : "mix3d.4dkankan.com", changeOrigin: true, rewrite: (path) => path.replace(new RegExp(`^/api`), ""), }, "/fusion": { target: dev ? "https://test-mix3d.4dkankan.com" : "mix3d.4dkankan.com", changeOrigin: true, rewrite: (path) => path.replace(new RegExp(`^/api`), "/fusion"), }, "/dev-code": { // target: "https://localhost:7173/", target: dev ? "https://test-mix3d.4dkankan.com/code" : "https://mix3d.4dkankan.com/code", changeOrigin: true, secure: false, rewrite: (path) => path.replace(new RegExp(`^/dev-code`), ""), }, "/swkk": { target: dev ? "https://test.4dkankan.com" : "https://www.4dkankan.com", changeOrigin: true, rewrite: (path) => path.replace(new RegExp(`^/swkk`), ""), }, "/service": { target: dev ? "https://test.4dkankan.com" : "https://www.4dkankan.com", changeOrigin: true, }, "/swss": { target: dev ? "https://uat-laser.4dkankan.com/uat" : "https://laser.4dkankan.com", changeOrigin: true, rewrite: (path) => path.replace(new RegExp(`^/swss`), ""), }, "/laser": { target: dev ? "https://uat-laser.4dkankan.com" : "https://laser.4dkankan.com", changeOrigin: true, rewrite: (path) => path.replace(new RegExp(`^/laser`), "/laser"), }, "/fdkk": { target: dev ? "https://uat-laser.4dkankan.com/uat" : "https://laser.4dkankan.com", changeOrigin: true, rewrite: (path) => path.replace(new RegExp(`^/swss`), ""), }, }, }, });