vite.config.ts 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. css: {
  27. preprocessorOptions: {
  28. scss: {
  29. additionalData: `@use "@/app/${app}/useStyle.scss" as *;`,
  30. },
  31. },
  32. },
  33. plugins: [
  34. vue(),
  35. ElementPlus({
  36. useSource: true,
  37. }),
  38. ],
  39. server: {
  40. port: 5173,
  41. host: "0.0.0.0",
  42. proxy: {
  43. "/api": {
  44. target: dev
  45. ? "http://test-mix3d.4dkankan.com"
  46. : "https://mix3d.4dkankan.com",
  47. changeOrigin: true,
  48. rewrite: (path) => path.replace(new RegExp(`^/api`), ""),
  49. },
  50. "/fusion": {
  51. target: dev
  52. ? "https://test-mix3d.4dkankan.com"
  53. : "https://mix3d.4dkankan.com",
  54. changeOrigin: true,
  55. rewrite: (path) => path.replace(new RegExp(`^/api`), "/fusion"),
  56. },
  57. "/dev-code": {
  58. // target: "https://localhost:7173/",
  59. target: dev
  60. ? "https://test-mix3d.4dkankan.com/code"
  61. : "https://mix3d.4dkankan.com/code",
  62. changeOrigin: true,
  63. secure: false,
  64. rewrite: (path) => path.replace(new RegExp(`^/dev-code`), ""),
  65. },
  66. "/swkk": {
  67. target: dev ? "https://test.4dkankan.com" : "https://www.4dkankan.com",
  68. changeOrigin: true,
  69. rewrite: (path) => path.replace(new RegExp(`^/swkk`), ""),
  70. },
  71. "/service": {
  72. target: dev ? "https://test.4dkankan.com" : "https://www.4dkankan.com",
  73. changeOrigin: true,
  74. },
  75. "/swss": {
  76. target: dev
  77. ? "https://uat-laser.4dkankan.com/uat"
  78. : "https://laser.4dkankan.com",
  79. changeOrigin: true,
  80. rewrite: (path) => path.replace(new RegExp(`^/swss`), ""),
  81. },
  82. "/laser": {
  83. target: dev
  84. ? "https://uat-laser.4dkankan.com"
  85. : "https://laser.4dkankan.com",
  86. changeOrigin: true,
  87. rewrite: (path) => path.replace(new RegExp(`^/laser`), "/laser"),
  88. },
  89. "/fdkk": {
  90. target: dev
  91. ? "https://uat-laser.4dkankan.com/uat"
  92. : "https://laser.4dkankan.com",
  93. changeOrigin: true,
  94. rewrite: (path) => path.replace(new RegExp(`^/swss`), ""),
  95. },
  96. },
  97. },
  98. });