import * as path from "path"; const resolve = (dir) => path.resolve(__dirname, dir); import { fileURLToPath, URL } from 'node:url' import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' // https://vitejs.dev/config/ export default defineConfig({ server:{ cors: true, proxy: { '/api2': { // 代理请求之后的请求地址(你的真实接口地址) target: 'https://cimweb.zjw.sh.cegn.cn:2008', // target: 'http://10.90.7.241:9443/data-business-prod/', secure: false, ws: true, // 跨域 changeOrigin: true, rewrite: (path) => path.replace(/^\/api2/, '') }, // 代理所有 /api 的请求,该求情将被代理到 target 中 '/api': { // 代理请求之后的请求地址(你的真实接口地址) target: 'https://cimweb.zjw.sh.cegn.cn:2007/data-business-prod/', // target: 'http://10.90.7.241:9443/data-business-prod/', secure: false, ws: true, // 跨域 changeOrigin: true, rewrite: (path) => path.replace(/^\/api/, '') }, }, }, https:true, build: { sourcemap:true, commonjsOptions: { include: /node_modules|unit\/map\/CityGis.Bridge.js/, } }, css:{ devSourcemap:true }, devtool: 'source-map', plugins: [ vue(), ], base:'./', publicDir: resolve('public'), resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) } } })