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