123456789101112131415161718192021222324252627282930313233343536 |
- 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'
- 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({
- plugins: [vue(), AutoImport({
- resolvers: [ElementPlusResolver()],
- }),
- Components({
- resolvers: [ElementPlusResolver()],
- }),],
- base:'./',
- publicDir: resolve('static'),
- resolve: {
- alias: {
- '@': fileURLToPath(new URL('./src', import.meta.url))
- }
- },
- server: {
- proxy: {
- "/api": {
- target: "http://10.90.7.241:9443/data-business-prod", // 所要代理的目标地址
- changeOrigin: true, //允许跨域
- rewrite: (path) => path.replace(/^\/api/, ""), // 重写传过来的path路径
- },
- },
- }
- })
|