61 lines
1.8 KiB
TypeScript
61 lines
1.8 KiB
TypeScript
import vue from '@vitejs/plugin-vue';
|
||
import path from 'path';
|
||
import AutoImport from 'unplugin-auto-import/vite';
|
||
import Icons from 'unplugin-icons/vite';
|
||
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers';
|
||
import Components from 'unplugin-vue-components/vite';
|
||
import { defineConfig } from 'vite';
|
||
|
||
import IconsResolver from 'unplugin-icons/resolver';
|
||
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';
|
||
|
||
// https://vitejs.dev/config/
|
||
export default defineConfig({
|
||
plugins: [
|
||
vue(),
|
||
AutoImport({
|
||
resolvers: [
|
||
// Auto import functions from Element Plus, e.g. ElMessage, ElMessageBox... (with style)
|
||
// 自动导入 Element Plus 相关函数,如:ElMessage, ElMessageBox... (带样式)
|
||
ElementPlusResolver(),
|
||
// Auto import icon components
|
||
// 自动导入图标组件
|
||
IconsResolver({
|
||
prefix: 'Icon',
|
||
}),
|
||
],
|
||
imports: ['vue', 'vue-router', 'vue-i18n'],
|
||
// auto-import.d.ts生成的位置(默认是在根目录)
|
||
dts: 'src/types/auto-import.d.ts',
|
||
}),
|
||
Components({
|
||
resolvers: [
|
||
// Auto register icon components
|
||
// 自动注册图标组件
|
||
IconsResolver({
|
||
enabledCollections: ['ep'],
|
||
}),
|
||
// Auto register Element Plus components
|
||
// 自动导入 Element Plus 组件
|
||
ElementPlusResolver(),
|
||
],
|
||
// auto-import.d.ts生成的位置(默认是在根目录)
|
||
dts: 'src/types/auto-import-components.d.ts',
|
||
}),
|
||
Icons({
|
||
autoInstall: true,
|
||
}),
|
||
createSvgIconsPlugin({
|
||
// 指定需要缓存的图标文件夹
|
||
iconDirs: [path.resolve(process.cwd(), 'src/assets/icons')],
|
||
// 指定symbolId格式
|
||
symbolId: 'icon-[dir]-[name]',
|
||
}),
|
||
],
|
||
resolve: {
|
||
alias: {
|
||
'@': path.resolve(__dirname, 'src'),
|
||
},
|
||
},
|
||
});
|