Add auto import svg as icon
This commit is contained in:
@@ -2,13 +2,27 @@ import { fileURLToPath, URL } from 'node:url'
|
||||
|
||||
import { defineConfig } from 'vite'
|
||||
import react from '@vitejs/plugin-react'
|
||||
import Icons from 'unplugin-icons/vite'
|
||||
import { FileSystemIconLoader } from 'unplugin-icons/loaders'
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': fileURLToPath(new URL('./src', import.meta.url))
|
||||
plugins: [
|
||||
react(),
|
||||
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))
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user