dhjk/vite.config.js

39 lines
1.0 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()],
}),
],
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-07 16:48:16 +08:00
target: 'http://10.0.0.29:9999',
// target: 'https://fywz.btdit.cn/',
2023-07-04 16:54:37 +08:00
changeOrigin: true,
2023-07-07 16:48:16 +08:00
rewrite: (path) => path.replace(/^\/api/, '')
2023-07-04 16:54:37 +08:00
// ws: true,// 开启webSocket
}
}
}
});