You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
760 B

5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
  1. import { fileURLToPath, URL } from 'node:url'
  2. import { defineConfig } from 'vite'
  3. import vue from '@vitejs/plugin-vue'
  4. // https://vite.dev/config/
  5. export default defineConfig({
  6. plugins: [
  7. vue(),
  8. ],
  9. resolve: {
  10. alias: {
  11. '@': fileURLToPath(new URL('./src', import.meta.url))
  12. },
  13. },
  14. server: {
  15. proxy: {
  16. '/api': {
  17. target: 'http://192.168.9.19:8080',
  18. changeOrigin: true,
  19. rewrite: (path) => path.replace(/^\/api/, '')
  20. },
  21. // 第二个代理配置,对应/otherApi路径的请求转发到第二个IP地址
  22. // '/otherApi': {
  23. // target: 'http://192.168.8.191:8080',
  24. // changeOrigin: true,
  25. // rewrite: (path) => path.replace(/^\/otherApi/, '')
  26. // }
  27. }
  28. }
  29. })