vite.config.ts 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. import { defineConfig } from "vite";
  2. import vue from "@vitejs/plugin-vue";
  3. import { resolve } from "path";
  4. import ElementPlus from "unplugin-element-plus/vite";
  5. let app = "fire";
  6. if (process.argv.length > 3) {
  7. app = process.argv[process.argv.length - 1].trim();
  8. }
  9. const dev = true;
  10. export default defineConfig({
  11. define: {
  12. VITE_APP_APP: JSON.stringify(app),
  13. },
  14. base: "./",
  15. build: {
  16. outDir: `dist/${app}`,
  17. },
  18. resolve: {
  19. alias: [
  20. {
  21. find: "@",
  22. replacement: resolve(__dirname, "./src"),
  23. },
  24. ],
  25. },
  26. plugins: [
  27. vue(),
  28. ElementPlus({
  29. useSource: true,
  30. }),
  31. ],
  32. server: {
  33. port: 5173,
  34. host: "0.0.0.0",
  35. proxy: {
  36. "/api": {
  37. target: dev ? "http://xj-mix3d.4dkankan.com" : "mix3d.4dkankan.com",
  38. changeOrigin: true,
  39. rewrite: (path) => path.replace(new RegExp(`^/api`), ""),
  40. },
  41. "/fusion-xj": {
  42. target: dev ? "https://xj-mix3d.4dkankan.com" : "mix3d.4dkankan.com",
  43. changeOrigin: true,
  44. rewrite: (path) => path.replace(new RegExp(`^/api`), "/fusion-xj"),
  45. },
  46. "/dev-code": {
  47. // target: "https://localhost:7173/",
  48. target: dev
  49. ? "https://xj-mix3d.4dkankan.com/code"
  50. : "https://mix3d.4dkankan.com/code",
  51. changeOrigin: true,
  52. secure: false,
  53. rewrite: (path) => path.replace(new RegExp(`^/dev-code`), ""),
  54. },
  55. "/swkk": {
  56. target: dev ? "https://test.4dkankan.com" : "https://www.4dkankan.com",
  57. changeOrigin: true,
  58. rewrite: (path) => path.replace(new RegExp(`^/swkk`), ""),
  59. },
  60. "/service": {
  61. target: dev ? "https://test.4dkankan.com" : "https://www.4dkankan.com",
  62. changeOrigin: true,
  63. },
  64. "/swss": {
  65. target: dev
  66. ? "https://uat-laser.4dkankan.com/uat"
  67. : "https://laser.4dkankan.com",
  68. changeOrigin: true,
  69. rewrite: (path) => path.replace(new RegExp(`^/swss`), ""),
  70. },
  71. "/laser": {
  72. target: dev
  73. ? "https://uat-laser.4dkankan.com"
  74. : "https://laser.4dkankan.com",
  75. changeOrigin: true,
  76. rewrite: (path) => path.replace(new RegExp(`^/laser`), "/laser"),
  77. },
  78. "/fdkk": {
  79. target: dev
  80. ? "https://uat-laser.4dkankan.com/uat"
  81. : "https://laser.4dkankan.com",
  82. changeOrigin: true,
  83. rewrite: (path) => path.replace(new RegExp(`^/swss`), ""),
  84. },
  85. },
  86. },
  87. });