vite.config.ts 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import { defineConfig } from "vite";
  2. import vue from "@vitejs/plugin-vue";
  3. import { resolve } from "path";
  4. // import vueJsx from "@vitejs/plugin-vue-jsx";
  5. function pathResolve(dir: string) {
  6. return resolve(process.cwd(), ".", dir);
  7. }
  8. // eslint-disable-next-line @typescript-eslint/no-var-requires
  9. // const path = require("path");
  10. // function resolve(dir: string) {
  11. // return path.join(__dirname, dir);
  12. // }
  13. // const proxyUrl = "https://test.lexiaoya.cn";
  14. const proxyUrl = "https://test.gym.lexiaoya.cn";
  15. // https://vitejs.dev/config/
  16. export default defineConfig({
  17. base: "./",
  18. plugins: [vue()],
  19. resolve: {
  20. alias: {
  21. // '@': resolve('/src'),
  22. // '@components': resolve('/src/components'),
  23. // '@views': resolve('/src/views')
  24. "@": pathResolve("src") + "/",
  25. "@components": pathResolve("src/components") + "/",
  26. "@views": pathResolve("src/views") + "/",
  27. },
  28. },
  29. server: {
  30. host: "0.0.0.0",
  31. strictPort: true,
  32. cors: true,
  33. https: false,
  34. proxy: {
  35. "/edu-app": {
  36. target: proxyUrl,
  37. changeOrigin: true,
  38. },
  39. "/api-backend": {
  40. target: proxyUrl,
  41. changeOrigin: true,
  42. },
  43. "/api-web": {
  44. target: proxyUrl,
  45. changeOrigin: true,
  46. },
  47. },
  48. },
  49. });