Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

vite-plugin-iconify-preset

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-plugin-iconify-preset

Preset the icon to be packaged

latest
npmnpm
Version
1.1.0
Version published
Weekly downloads
16
6.67%
Maintainers
1
Weekly downloads
 
Created
Source

vite-plugin-iconify-preset

100+流行的集合超过10,000图标,标志,表情符号等。Iconify提供支持。
支持vite构建的vue2、vue3、react项目

该包是为了弥补<i-ant-design-caret-down-filled />这种按需引入的不足,这种写法很好用,但在项目中往往需要<Icon class="icon" :name="name" :width="width" :height="height" />这种写法,并把将要用到的图标预先设置好将其打包。例如图标显示哪一个,需要从接口中获取。模版中按需引入的(<i-ant-design-caret-down-filled />)写法此时无法满足需求,于是写了此包。

安装

  npm i vite-plugin-iconify-preset

预设配置

 // vite.config.ts
 import Icon from 'vite-plugin-iconify-preset'

  plugins: [
    ...,
    Icon([
      'ant-design:linkedin-outlined',
      'ant-design:ant-design-outlined',
      ...
    ])
  ]

组件使用

// vue3
import { Icon } from 'vite-plugin-iconify-preset/vue'
// vue2
import { Icon } from 'vite-plugin-iconify-preset/vue2'
components: {
  Icon
}

<Icon
  class="icon"
  :name="name"
  :width="width"
  :height="height"
/>

// react
import { Icon } from 'vite-plugin-iconify-preset/react'

<Icon
  className="icon"
  name={name}
  width={width}
  height={height}
/>
报错问题

找不到模块“vite-plugin-iconify-preset/vue”或其相应的类型声明 如果出现这样的编辑器报错,可在tsconfig文件下include配置".d.ts",在".d.ts"文件内声明:declare module 'vite-plugin-iconify-preset/vue' (react 亦此)

icon图标地址

https://icones.netlify.app/

联系方式

邮箱: 237613578@qq.com 如发现问题或是有疑惑请联系作者

Keywords

vite

FAQs

Package last updated on 19 May 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts