1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- 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))
- }
- }
- })
|