vite.config.ts 827 B

123456789101112131415161718192021222324252627282930313233343536
  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. proxy: {
  14. '/api': {
  15. target: 'http://192.168.11.77:8888',
  16. changeOrigin: true,
  17. rewrite: (path) => {
  18. return path.replace(/\/api/, '/api')
  19. }
  20. },
  21. '/app': {
  22. target: 'http://192.168.11.77:8080',
  23. changeOrigin: true,
  24. rewrite: (path) => {
  25. return path.replace(/\/app/, '/api')
  26. }
  27. }
  28. }
  29. },
  30. resolve: {
  31. alias: {
  32. "@": pathSrc,
  33. },
  34. },
  35. }
  36. })