import { defineConfig, loadEnv } from "vite"; import vue from "@vitejs/plugin-vue"; import { resolve } from "path"; import ElementPlus from "unplugin-element-plus/vite"; import { AppType, AppConstant } from "./src/app/appType"; import { appConstant } from "./src/app/fire/constant"; // import { appConstant } from "./src/app/criminal/constant"; export default async ({ mode }) => { const app = AppType.fire; // const appConstant = (await import(`./src/app/${app}/constant`)) // .AppConstant as AppConstant; return defineConfig({ define: { VITE_APP_APP: JSON.stringify(app), }, resolve: { alias: [ { find: "@", replacement: resolve(__dirname, "./src"), }, ], }, css: { preprocessorOptions: { scss: { additionalData: `@use "${appConstant.useScssPath}" as *;`, }, }, }, plugins: [ vue(), ElementPlus({ useSource: true, }), ], server: { // https:true, // port:8080, // 设置代理proxy proxy: { "/api": { // target: 'http://192.168.0.135:8585/', target: "http://test-mix3d.4dkankan.com", // target: 'https://testhuodiao.4dkankan.com/', changeOrigin: true, rewrite: (path) => path.replace(new RegExp(`^/api`), ""), }, "/fusion": { target: "https://test-mix3d.4dkankan.com", changeOrigin: true, rewrite: (path) => path.replace(new RegExp(`^/api`), "/fusion"), }, "/dev-code": { target: "https://test-mix3d.4dkankan.com/code", changeOrigin: true, rewrite: (path) => path.replace(new RegExp(`^/dev-code`), ""), }, "/swkk": { target: "https://test.4dkankan.com", changeOrigin: true, rewrite: (path) => path.replace(new RegExp(`^/swkk`), ""), }, "/service": { target: "https://test.4dkankan.com", changeOrigin: true, }, "/swss": { target: "https://uat-laser.4dkankan.com/uat", changeOrigin: true, rewrite: (path) => path.replace(new RegExp(`^/swss`), ""), }, "/laser": { target: "https://uat-laser.4dkankan.com", changeOrigin: true, rewrite: (path) => path.replace(new RegExp(`^/swss`), ""), }, "/fdkk": { target: "https://uat-laser.4dkankan.com", changeOrigin: true, rewrite: (path) => path.replace(new RegExp(`^/swss`), ""), }, }, }, }); };