wrj_bmgl/vite.config.js

54 lines
1.6 KiB
JavaScript
Raw Normal View History

2024-09-26 17:09:43 +08:00
import { defineConfig } from "vite";
import { fileURLToPath, URL } from "url";
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({
base: "./",
plugins: [
vue(),
AutoImport({
// resolvers: [ElementPlusResolver()],
}),
Components({
// resolvers: [ElementPlusResolver()],
directoryAsNamespace: true,
}),
],
resolve: {
extensions: [".js", ".vue"],
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)),
},
},
server: {
host: "0.0.0.0", // 解决“vite use `--host` to expose”-- 0.0.0.0 将监听所有地址
proxy: {
"/api": {
target: 'http://192.168.2.85:19086/',//李
// target: 'https://jianlu.fpvone.cn/',//线上
changeOrigin: true,
// rewrite: (path) => path.replace(/^\/api/, '')
// ws: true,// 开启webSocket
},
"/app": {
target: 'http://192.168.2.85:19086/',//李
// target: 'https://jianlu.fpvone.cn/',//线上
changeOrigin: true,
// rewrite: (path) => path.replace(/^\/api/, '')
// ws: true,// 开启webSocket
},
"/upload": {
target: 'http://192.168.2.85:19086/',//李
// target: 'https://jianlu.fpvone.cn/',//线上
changeOrigin: true,
// rewrite: (path) => path.replace(/^\/api/, '')
// ws: true,// 开启webSocket
},
},
},
});