41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
import { fileURLToPath, URL } from 'node:url'
|
|
|
|
import { defineConfig, PluginOption } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
import Icons from 'unplugin-icons/vite'
|
|
import { FileSystemIconLoader } from 'unplugin-icons/loaders'
|
|
import IconsResolver from 'unplugin-icons/resolver'
|
|
import AutoImport from 'unplugin-auto-import/vite'
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig({
|
|
plugins: [
|
|
react(),
|
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
AutoImport({
|
|
resolvers: [
|
|
IconsResolver({
|
|
prefix: 'icon',
|
|
extension: 'jsx',
|
|
customCollections: ['framework']
|
|
})
|
|
]
|
|
}) as PluginOption,
|
|
Icons({
|
|
compiler: 'jsx',
|
|
jsx: 'react',
|
|
autoInstall: true,
|
|
customCollections: {
|
|
framework: FileSystemIconLoader('src/assets/svg', (svg) =>
|
|
svg.replace(/^svg /, '<svg fill="currentColor"')
|
|
)
|
|
}
|
|
})
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
'@': fileURLToPath(new URL('./src', import.meta.url))
|
|
}
|
|
}
|
|
})
|