nova-admin/build/plugins/unplugin.ts
2022-08-12 17:12:06 +08:00

26 lines
837 B
TypeScript

import Components from 'unplugin-vue-components/vite';
import { NaiveUiResolver } from 'unplugin-vue-components/resolvers';
import Icons from 'unplugin-icons/vite';
import IconsResolver from 'unplugin-icons/resolver';
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'; // https://github.com/vbenjs/vite-plugin-svg-icons/blob/main/README.zh_CN.md
import path from 'path';
export default [
Components({
dts: 'src/types/components.d.ts',
resolvers: [IconsResolver(), NaiveUiResolver()],
}),
Icons({
/* options */
compiler: 'vue3',
}),
createSvgIconsPlugin({
// 指定需要缓存的图标文件夹
iconDirs: [path.resolve(process.cwd(), 'src/assets/svg')],
// 指定symbolId格式
symbolId: 'icon-[dir]-[name]',
inject: 'body-last',
customDomId: '__svg__icons__dom__',
}),
];