Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: 重构图标模块,使用@iconify/json替换不再维护更新的@iconify-icons/*依赖,优化使用体验,确保图标库可持续更新并支持Tree-shaking #1202

Merged
merged 7 commits into from
Mar 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build/optimize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ const include = [

/**
* 在预构建中强制排除的依赖项
* 温馨提示:所有以 `@iconify-icons/` 开头引入的的本地图标模块,都应该加入到下面的 `exclude` 里,因为平台推荐的使用方式是哪里需要哪里引入而且都是单个的引入,不需要预构建,直接让浏览器加载就好
* 温馨提示:平台推荐的使用方式是哪里需要哪里引入而且都是单个的引入,不需要预构建,直接让浏览器加载就好
*/
const exclude = ["@iconify-icons/ep", "@iconify-icons/ri"];
const exclude = ["@iconify/json"];

export { include, exclude };
6 changes: 6 additions & 0 deletions build/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import vue from "@vitejs/plugin-vue";
import { pathResolve } from "./utils";
import { viteBuildInfo } from "./info";
import svgLoader from "vite-svg-loader";
import Icons from "unplugin-icons/vite";
import type { PluginOption } from "vite";
import vueJsx from "@vitejs/plugin-vue-jsx";
import { configCompressPlugin } from "./compress";
Expand Down Expand Up @@ -57,6 +58,11 @@ export function getPluginsList(
}),
// svg组件化支持
svgLoader(),
// 自动按需加载图标
Icons({
compiler: "vue3",
scale: 1
}),
VITE_CDN ? cdn : null,
configCompressPlugin(VITE_COMPRESSION),
// 线上环境删除console
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"@logicflow/extension": "^1.2.28",
"@pureadmin/descriptions": "^1.2.1",
"@pureadmin/table": "^3.2.1",
"@pureadmin/utils": "^2.5.0",
"@pureadmin/utils": "^2.6.0",
"@vue-flow/background": "^1.3.2",
"@vue-flow/core": "^1.42.1",
"@vueuse/core": "^12.5.0",
Expand Down Expand Up @@ -119,8 +119,7 @@
"@commitlint/types": "^19.5.0",
"@eslint/js": "^9.20.0",
"@faker-js/faker": "^9.5.0",
"@iconify-icons/ep": "^1.2.12",
"@iconify-icons/ri": "^1.2.10",
"@iconify/json": "^2.2.319",
"@iconify/vue": "4.2.0",
"@intlify/unplugin-vue-i18n": "^6.0.3",
"@types/codemirror": "^5.60.15",
Expand Down Expand Up @@ -166,6 +165,7 @@
"svgo": "^3.3.2",
"tailwindcss": "3.4.17",
"typescript": "^5.7.3",
"unplugin-icons": "^22.1.0",
"vite": "^6.1.0",
"vite-plugin-cdn-import": "^1.0.1",
"vite-plugin-compression": "^0.5.1",
Expand Down
Loading