从我能够得出的结论来看,两者都没有区别,因此性能应该没有区别。
反应图标:
- 版本:v4.1.0
- 两个月前发表
- 命令:
npm i react-icons
@react-icons/所有文件
- 版本:v4.1.0
- 两个月前发表
- 命令:
npm i @react-icons/all-files
两者都引用相同的 Github repo,并且在repo 包中引用文件 package.json 是相同的:
包.json:
{
"name": "@react-icons/all-files",
"version": "4.1.1-snapshot.0",
"description": "SVG React icons of popular icon packs using ES6 imports",
"author": "Goran Gajic",
"contributors": [
"kamijin_fanta <kamijin@live.jp>"
],
"license": "MIT",
"main": "lib",
"types": "./lib/esm/index.d.ts",
"sideEffects": false,
"repository": {
"type": "git",
"url": "git+ssh://git@github.com:react-icons/react-icons.git"
},
"bugs": {
"url": "https://github.com/react-icons/react-icons/issues"
},
"homepage": "https://github.com/react-icons/react-icons#readme",
"peerDependencies": {
"react": "*"
}
}
但是当引用文档时,应该使用某些状态:
对于标准的现代项目:
npm install react-icons --save
对于meteorjs、gatsbyjs等:
如果您的项目规模扩大,则此选项可用。这种方法的代价是安装软件包需要很长时间。适用于 MeteorJS、Gatsbyjs 等。
npm install @react-icons/all-files --save
当涉及到命令时:
import { FaPercent, FaCapsules, FaRing } from "react-icons/fa"
这是参考font-awesome的图书馆。如果您在 node_modules 中引用已安装的目录,则所有图标包都位于两个字符目录中:
ai
bi
bs
cg
di
fa
etc.
etc.
如果您想引用任何其他图标,您只需附加两位数字符集,例如:
import { IconName } from "react-icons/gr";
索环图标