vite.config.ts 845 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import { defineConfig, loadEnv } from 'vite'
  2. import vue from '@vitejs/plugin-vue'
  3. // https://vitejs.dev/config/
  4. import { resolve } from "path";
  5. const pathSrc = resolve(__dirname, "src");
  6. export default defineConfig(({ mode }) => {
  7. const config = loadEnv(mode, './')
  8. return {
  9. plugins: [
  10. vue(),
  11. ],
  12. server: {
  13. port: 5000,
  14. proxy: {
  15. '/api': {
  16. target: 'http://192.168.11.77:8888',
  17. changeOrigin: true,
  18. rewrite: (path) => {
  19. return path.replace(/\/api/, '/api')
  20. }
  21. },
  22. '/app': {
  23. target: 'http://192.168.11.77:8080',
  24. changeOrigin: true,
  25. rewrite: (path) => {
  26. return path.replace(/\/app/, '/api')
  27. }
  28. }
  29. }
  30. },
  31. resolve: {
  32. alias: {
  33. "@": pathSrc,
  34. },
  35. },
  36. }
  37. })