vite.config.ts 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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 ? "http://test-mix3d.4dkankan.com" : "mix3d.4dkankan.com",
  45. changeOrigin: true,
  46. rewrite: (path) => path.replace(new RegExp(`^/api`), ""),
  47. },
  48. "/fusion": {
  49. target: dev ? "https://test-mix3d.4dkankan.com" : "mix3d.4dkankan.com",
  50. changeOrigin: true,
  51. rewrite: (path) => path.replace(new RegExp(`^/api`), "/fusion"),
  52. },
  53. "/dev-code": {
  54. // target: "https://localhost:7173/",
  55. target: dev
  56. ? "https://test-mix3d.4dkankan.com/code"
  57. : "https://mix3d.4dkankan.com/code",
  58. changeOrigin: true,
  59. secure: false,
  60. rewrite: (path) => path.replace(new RegExp(`^/dev-code`), ""),
  61. },
  62. "/swkk": {
  63. target: dev ? "https://test.4dkankan.com" : "https://www.4dkankan.com",
  64. changeOrigin: true,
  65. rewrite: (path) => path.replace(new RegExp(`^/swkk`), ""),
  66. },
  67. "/service": {
  68. target: dev ? "https://test.4dkankan.com" : "https://www.4dkankan.com",
  69. changeOrigin: true,
  70. },
  71. "/swss": {
  72. target: dev
  73. ? "https://uat-laser.4dkankan.com/uat"
  74. : "https://laser.4dkankan.com",
  75. changeOrigin: true,
  76. rewrite: (path) => path.replace(new RegExp(`^/swss`), ""),
  77. },
  78. "/laser": {
  79. target: dev
  80. ? "https://uat-laser.4dkankan.com"
  81. : "https://laser.4dkankan.com",
  82. changeOrigin: true,
  83. rewrite: (path) => path.replace(new RegExp(`^/laser`), "/laser"),
  84. },
  85. "/fdkk": {
  86. target: dev
  87. ? "https://uat-laser.4dkankan.com/uat"
  88. : "https://laser.4dkankan.com",
  89. changeOrigin: true,
  90. rewrite: (path) => path.replace(new RegExp(`^/swss`), ""),
  91. },
  92. },
  93. },
  94. });