1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- import { defineConfig, loadEnv } from "vite";
- import vue from "@vitejs/plugin-vue";
- import { resolve } from "path";
- import { AppConfig, AppType } from "./src/constant/app";
- import ElementPlus from "unplugin-element-plus/vite";
- // https://vitejs.dev/config/
- export default ({ mode }) => {
- const env = loadEnv(mode, process.cwd());
- const config = AppConfig[env.VITE_APP_APP as AppType];
- return defineConfig({
- resolve: {
- alias: [
- {
- find: "@",
- replacement: resolve(__dirname, "./src"),
- },
- ],
- },
- css: {
- preprocessorOptions: {
- scss: {
- additionalData: `@use "${config.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`), ""),
- },
- },
- },
- });
- };
|