vite.config.ts 2.4 KB

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