vite.config.js 792 B

1234567891011121314151617181920212223242526272829303132333435
  1. import { fileURLToPath, URL } from 'node:url'
  2. import { defineConfig } from 'vite'
  3. import vue from '@vitejs/plugin-vue'
  4. import vueDevTools from 'vite-plugin-vue-devtools'
  5. // https://vite.dev/config/
  6. export default defineConfig({
  7. plugins: [
  8. vue(),
  9. vueDevTools(),
  10. ],
  11. resolve: {
  12. alias: {
  13. '@': fileURLToPath(new URL('./src', import.meta.url))
  14. },
  15. },
  16. server: {
  17. port: 5173,
  18. proxy: {
  19. // 管理端接口 -> 直接访问管理端服务
  20. '/admin': {
  21. target: 'http://localhost:8088',
  22. changeOrigin: true,
  23. rewrite: (path) => path
  24. },
  25. // 其他微服务接口 -> 通过网关访问
  26. '/api': {
  27. target: 'http://localhost:8083',
  28. changeOrigin: true,
  29. rewrite: (path) => path
  30. }
  31. }
  32. }
  33. })