123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- import path from "path";
- const resolve = (dir) => path.resolve(__dirname, dir);
- import { defineConfig } from 'vite'
- import vue from '@vitejs/plugin-vue'
- import {fileURLToPath, URL} from "node:url";
- import AutoImport from 'unplugin-auto-import/vite'
- import Components from 'unplugin-vue-components/vite'
- import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
- // https://vitejs.dev/config/
- export default defineConfig({
- server:{
- cors: true,
- https:true,
- proxy: {
- // 代理所有 /api 的请求,该求情将被代理到 target 中
- '/api': {
- // 代理请求之后的请求地址(你的真实接口地址)
- target: 'https://10.90.11.49:2007/data-business-prod/',
- secure: false,
- ws: true,
- // 跨域
- changeOrigin: true,
- rewrite: (path) => path.replace(/^\/api/, '')
- },
- '/addressapi': {
- // 代理请求之后的请求地址(你的真实接口地址)
- target: 'https://10.90.11.49:2008',
- secure: false,
- ws: true,
- // 跨域
- changeOrigin: true,
- rewrite: (path) => path.replace(/^\/addressapi/, '')
- }
- },
- },
- plugins: [vue(), AutoImport({
- resolvers: [ElementPlusResolver()],
- }),
- Components({
- resolvers: [ElementPlusResolver()],
- }),],
- base:'./',
- publicDir: resolve('static'),
- resolve: {
- alias: {
- '@': fileURLToPath(new URL('./src', import.meta.url))
- }
- }
- })
|