perf(build): 图标改为离线子集并精简图表依赖
web-ci / build (push) Canceled after 0s

This commit is contained in:
Vicky authored and trae-solo-agent committed 2026-10-30 17:14:51 +08:00
1 parent dd4be08d49
commit 2f52011491
7 files changed
+34 -67

No files matched your search

+2 -31
View File
@@ -1,35 +1,7 @@
// Author: fruit.com.cn
import { defineConfig, toEscapedSelector as e, presetUno, presetIcons } from 'unocss'
import { defineConfig, toEscapedSelector as e, presetUno } from 'unocss'
import transformerVariantGroup from '@unocss/transformer-variant-group'
import { loadEnv } from 'vite'
import { AppIcons } from './src/constants/icons'
const root = process.cwd()
const createPresetIcons = () => {
const isBuild = !!process.argv[4]
let env = {} as any
if (!isBuild) {
env = loadEnv(process.argv[3], root)
} else {
env = loadEnv(process.argv[4], root)
}
// @ts-ignore
if (env.VITE_USE_ONLINE_ICON === 'true') {
return []
} else {
return [
presetIcons({
prefix: '',
collections: {
'material-symbols': () =>
import('@iconify/json/json/material-symbols.json').then((i) => i.default)
}
})
]
}
}
export default defineConfig({
// ...UnoCSS options
@@ -141,8 +113,7 @@ ${selector}:after {
}
]
],
safelist: Object.values(AppIcons),
presets: [presetUno({ dark: 'class', attributify: false }), ...createPresetIcons()],
presets: [presetUno({ dark: 'class', attributify: false })],
transformers: [transformerVariantGroup()],
content: {
pipeline: {