vite.config.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import * as path from "path";
  2. const resolve = (dir) => path.resolve(__dirname, dir);
  3. import { fileURLToPath, URL } from 'node:url'
  4. import { defineConfig } from 'vite'
  5. import vue from '@vitejs/plugin-vue'
  6. // https://vitejs.dev/config/
  7. export default defineConfig({
  8. server:{
  9. cors: true,
  10. proxy: {
  11. '/api': {
  12. // 代理请求之后的请求地址(你的真实接口地址)
  13. target: 'http://10.90.9.143:9252/DataSearch/',
  14. //target: 'http://localhost:9250/',
  15. secure: false,
  16. ws: true,
  17. // 跨域
  18. changeOrigin: true,
  19. rewrite: (path) => path.replace(/^\/api/, '')
  20. },
  21. '/netapi': {
  22. // 代理请求之后的请求地址(你的真实接口地址)
  23. // target: 'http://58.34.215.19:19259/DataSearch/',
  24. target: 'http://10.1.163.15:19259/DataSearch/',
  25. //target: 'http://localhost:9250/',
  26. secure: false,
  27. ws: true,
  28. // 跨域
  29. changeOrigin: true,
  30. rewrite: (path) => path.replace(/^\/netapi/, '')
  31. },
  32. }
  33. },
  34. plugins: [vue()],
  35. base:'/map-tool-widget-4301227/',
  36. publicDir: resolve('static'),
  37. })