dhjk/vite.config.js

48 lines
1.3 KiB
JavaScript
Raw Normal View History

2023-07-04 16:54:37 +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({
plugins: [
vue(),
AutoImport({
// resolvers: [ElementPlusResolver()],
}),
Components({
// resolvers: [ElementPlusResolver()],
2023-07-13 11:56:06 +08:00
directoryAsNamespace: true
2023-07-04 16:54:37 +08:00
}),
],
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': {
2023-07-10 17:30:13 +08:00
// target: 'http://10.0.0.29:9999',
2023-08-26 11:48:59 +08:00
// target: 'http://demo35.ydool.net/',
2023-09-26 17:26:02 +08:00
target: 'http://192.168.1.11:10875',
2023-07-17 17:30:56 +08:00
// target: 'http://10.0.0.63:7777', // 刘进
2023-07-04 16:54:37 +08:00
changeOrigin: true,
2023-07-13 11:56:06 +08:00
// rewrite: (path) => path.replace(/^\/api/, '')
2023-07-04 16:54:37 +08:00
// ws: true,// 开启webSocket
2023-08-15 11:32:24 +08:00
},
'/metadata': {
2023-09-04 16:24:12 +08:00
target: 'http://192.168.1.27:7777',
2023-08-15 11:32:24 +08:00
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '')
// ws: true,// 开启webSocket
2023-07-04 16:54:37 +08:00
}
}
}
});