vite.config.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. resolve: {
  11. alias: {
  12. // 将 ArcGIS API 本地路径指向 node_modules 中的 `@arcgis/core`
  13. '@arcgis/core': path.resolve(__dirname, 'node_modules/@arcgis/core')
  14. }
  15. },
  16. proxy: {
  17. '/api': {
  18. // 代理请求之后的请求地址(你的真实接口地址)
  19. target: 'http://10.90.9.143:9252/DataSearch/',
  20. //target: 'http://localhost:9250/',
  21. secure: false,
  22. ws: true,
  23. // 跨域
  24. changeOrigin: true,
  25. rewrite: (path) => path.replace(/^\/api/, '')
  26. },
  27. '/zwapi': {
  28. // 代理请求之后的请求地址(你的真实接口地址)
  29. target: 'https://cimweb.zjw.sh.cegn.cn:2008/',
  30. //target: 'http://10.1.163.15:19259/DataSearch/',
  31. //target: 'http://localhost:9250/',
  32. secure: false,
  33. ws: true,
  34. // 跨域
  35. changeOrigin: true,
  36. rewrite: (path) => path.replace(/^\/zwapi/, '')
  37. },
  38. '/netapi': {
  39. // 代理请求之后的请求地址(你的真实接口地址)
  40. target: 'http://58.34.215.19:8100/DataSearch/',
  41. //target: 'http://10.1.163.15:19259/DataSearch/',
  42. //target: 'http://localhost:9250/',
  43. secure: false,
  44. ws: true,
  45. // 跨域
  46. changeOrigin: true,
  47. rewrite: (path) => path.replace(/^\/netapi/, '')
  48. },
  49. }
  50. },
  51. plugins: [vue()],
  52. base:'/map-tool-widget-4301227/',
  53. publicDir: resolve('static'),
  54. })