46 lines
1.3 KiB
TypeScript
46 lines
1.3 KiB
TypeScript
import { defineConfig, loadEnv } from 'vite';
|
|
import Components from "unplugin-vue-components/vite"; // 按需组件自动导入
|
|
import { AntDesignVueResolver } from "unplugin-vue-components/resolvers";
|
|
import vue from '@vitejs/plugin-vue';
|
|
import Icons from 'unplugin-icons/vite';
|
|
import IconsResolver from 'unplugin-icons/resolver';
|
|
import path from 'path';
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
plugins: [
|
|
vue(),
|
|
Components({
|
|
dts: true, //生成components.d.ts 全局定义文件
|
|
resolvers: [
|
|
AntDesignVueResolver({ //对使用到的全局ant design vue组件进行类型导入
|
|
importStyle: false, // 不动态引入css,这个不强求
|
|
}),
|
|
// 自动导入 lucide 图标
|
|
IconsResolver({
|
|
prefix: 'i', // 比如用 <i-a-arrow-down />
|
|
enabledCollections: ['lucide']
|
|
})
|
|
],
|
|
include: [/\.vue$/, /\.vue\?vue/, /\.md$/, /\.tsx$/], //包含的文件类型
|
|
}),
|
|
Icons({
|
|
autoInstall: true, // 没安装的图标库会自动下载
|
|
}),
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, 'src'),
|
|
},
|
|
},
|
|
server: {
|
|
proxy: {
|
|
'/api': {
|
|
target: 'http://localhost:3000',
|
|
changeOrigin: true,
|
|
rewrite: path => path.replace(/^\/api/, '')
|
|
}
|
|
}
|
|
}
|
|
})
|