2022-08-27 14:09:32 +08:00
|
|
|
|
import { resolve } from 'path'
|
2022-06-19 15:22:01 +08:00
|
|
|
|
import AutoImport from 'unplugin-auto-import/vite'
|
2022-06-19 13:35:36 +08:00
|
|
|
|
import Components from 'unplugin-vue-components/vite'
|
|
|
|
|
import { NaiveUiResolver } from 'unplugin-vue-components/resolvers'
|
|
|
|
|
import { FileSystemIconLoader } from 'unplugin-icons/loaders'
|
|
|
|
|
import IconsResolver from 'unplugin-icons/resolver'
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* * unplugin-icons插件,自动引入iconify图标
|
|
|
|
|
* usage: https://github.com/antfu/unplugin-icons
|
|
|
|
|
* 图标库: https://icones.js.org/
|
|
|
|
|
*/
|
|
|
|
|
import Icons from 'unplugin-icons/vite'
|
2022-08-27 11:46:34 +08:00
|
|
|
|
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
|
2022-06-19 13:35:36 +08:00
|
|
|
|
|
2022-08-27 14:09:32 +08:00
|
|
|
|
import { getSrcPath } from '../utils'
|
|
|
|
|
|
|
|
|
|
const customIconPath = resolve(getSrcPath(), 'assets/svg')
|
2022-06-19 13:35:36 +08:00
|
|
|
|
|
|
|
|
|
export default [
|
2022-06-19 15:22:01 +08:00
|
|
|
|
AutoImport({
|
|
|
|
|
imports: ['vue', 'vue-router'],
|
2022-07-10 22:24:23 +08:00
|
|
|
|
dts: false,
|
2022-06-19 15:22:01 +08:00
|
|
|
|
}),
|
2022-06-19 13:35:36 +08:00
|
|
|
|
Icons({
|
|
|
|
|
compiler: 'vue3',
|
|
|
|
|
customCollections: {
|
|
|
|
|
custom: FileSystemIconLoader(customIconPath),
|
|
|
|
|
},
|
|
|
|
|
scale: 1,
|
|
|
|
|
defaultClass: 'inline-block',
|
|
|
|
|
}),
|
|
|
|
|
Components({
|
2023-05-07 22:05:13 +08:00
|
|
|
|
resolvers: [
|
|
|
|
|
NaiveUiResolver(),
|
|
|
|
|
IconsResolver({ customCollections: ['custom'], componentPrefix: 'icon' }),
|
|
|
|
|
],
|
2022-07-10 22:24:23 +08:00
|
|
|
|
dts: false,
|
2022-06-19 13:35:36 +08:00
|
|
|
|
}),
|
2022-08-27 11:46:34 +08:00
|
|
|
|
createSvgIconsPlugin({
|
|
|
|
|
iconDirs: [customIconPath],
|
|
|
|
|
symbolId: 'icon-custom-[dir]-[name]',
|
|
|
|
|
inject: 'body-last',
|
|
|
|
|
customDomId: '__CUSTOM_SVG_ICON__',
|
|
|
|
|
}),
|
2022-06-19 13:35:36 +08:00
|
|
|
|
]
|