yifengyide/vite.config.ts
2025-02-07 16:12:06 +08:00

50 lines
1.1 KiB
TypeScript
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 { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import AutoImport from "unplugin-auto-import/vite";
import Components from "@layui/unplugin-vue-components/vite";
import { LayuiVueResolver } from '@layui/unplugin-vue-components/resolvers'
import { resolve } from "path";
const excludeComponents = ['LightIcon','DarkIcon']
export default defineConfig({
resolve: {
alias: [
{
find: '@',
replacement: resolve(__dirname, './src')
}
]
},
server: {
proxy: {
'/api': {
// 用于开发环境下的转发请求
// 更多请参考https://vitejs.dev/config/#server-proxy
target: 'http://192.168.10.158/',
pathRewrite: {
'^/api': ''
},
changeOrigin: true,
},
},
},
plugins: [
AutoImport({
resolvers: [
LayuiVueResolver(),
],
}),
Components({
resolvers: [
LayuiVueResolver({
resolveIcons: true,
exclude: excludeComponents
}),
],
}),
vue(),
],
});