2024-05-29 10:39:56 +08:00

55 lines
1.6 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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({
outputDir: '../wu-smart-agent-network-heartbeat-client/src/resources/network-local-client-ui/v1', // 构建时输出目录
base: './',
plugins: [
vue(),
AutoImport({
resolvers: [ElementPlusResolver()],
}),
Components({
resolvers: [ElementPlusResolver()],
}),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
publicPath: "",
productionSourceMap: false,
server: {
port: "38080", // 请求地址的端口号在本项目是38080
proxy: {
'/v1/api': {
target: "http://127.0.0.1:6004", // 真实的服务器地址
changeOrigin: true, //
secure: false, // 默认情况下,不接受运行在 HTTPS 上且使用了无效证书的后端服务器。如果你想要接受设为false
ws: false, // 是否启用websockets
// 是否重写
pathRewrite: {
"^/v1/api": "/v1/api",
},
},
'/upload': {
target: 'http://localhost:3300/upload',
changeOrigin: true,
ws: true,
rewrite: (path) => path.replace(new RegExp(`^/upload`), ''),
},
},
warmup: {
clientFiles: ['./index.html', './src/{views,components}/*'],
},
},
})