vite.config.ts 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. // https://vitejs.dev/config/
  15. export default defineConfig({
  16. plugins: [vue()],
  17. resolve: {
  18. alias: {
  19. // '@': resolve('/src'),
  20. // '@components': resolve('/src/components'),
  21. // '@views': resolve('/src/views')
  22. "@": pathResolve("src") + "/",
  23. "@components": pathResolve("src/components") + "/",
  24. "@views": pathResolve("src/views") + "/",
  25. },
  26. },
  27. server: {
  28. host: "0.0.0.0",
  29. strictPort: true,
  30. cors: true,
  31. https: false,
  32. proxy: {
  33. "/edu-app": {
  34. target: proxyUrl,
  35. changeOrigin: true,
  36. },
  37. },
  38. },
  39. });