perf: ECharts按需收窄
全仓 grep 确认存活消费方只有 views/stats/overview(line/bar/pie 系列 + tooltip/grid/legend/title 组件)与 hooks/core/useChart(core 自带 的 init/setOption/resize/dispose);art-* 图表库组件(scatter/radar/ k-line 及 dataZoom/toolbox/brush/geo/visualMap/markLine/markPoint) 无任何页面挂载。 echarts.use 收窄为 Bar/Line/Pie + Title/Tooltip/Grid/Legend + CanvasRenderer。graphic 与类型导出不动(未挂载库组件的 import 仍需 编译通过);组件文件保留,属模板库代码不在本任务删除范围。 构建对比(同机 pnpm build): - echarts chunk: 767,864 B → 559,737 B(-208 KB / -27.1%;gzip 251 KB → 187 KB) - dist 总体积: 3,256,483 B → 2,983,300 B(-273 KB / -8.4%) (chunk 内残留的 candlestick/radar/scatter 字样为核心 locale 名表 与主题色表,非图表实现。) vitest 156 passed;build 通过;components.d.ts/auto-imports.d.ts 行尾漂移已还原。 Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,14 @@
|
||||
* 按需导入 ECharts 图表和组件,减小打包体积。
|
||||
* 只注册项目中实际使用的图表类型和组件。
|
||||
*
|
||||
* Phase 4 Task 5D 收窄:全仓 grep 后,存活消费方只有
|
||||
* views/stats/overview(charts.ts 的 line/bar/pie 系列 + tooltip/
|
||||
* grid/legend/title 组件)与 hooks/core/useChart(init/setOption/
|
||||
* resize/dispose,core 自带)。art-* 图表库组件(scatter/radar/k-line
|
||||
* 及 dataZoom/toolbox/brush/geo/visualMap/markLine/markPoint)均无
|
||||
* 页面挂载——相应注册一并移除;组件文件保留(模板库代码),graphic/
|
||||
* 类型导出不动(未挂载组件的 import 仍可编译)。
|
||||
*
|
||||
* @module plugins/echarts
|
||||
* @author Art Design Pro Team
|
||||
*/
|
||||
@@ -12,29 +20,14 @@
|
||||
import * as echarts from 'echarts/core'
|
||||
|
||||
// 导入图表类型
|
||||
import {
|
||||
BarChart,
|
||||
LineChart,
|
||||
PieChart,
|
||||
ScatterChart,
|
||||
RadarChart,
|
||||
MapChart,
|
||||
CandlestickChart
|
||||
} from 'echarts/charts'
|
||||
import { BarChart, LineChart, PieChart } from 'echarts/charts'
|
||||
|
||||
// 导入组件
|
||||
import {
|
||||
TitleComponent,
|
||||
TooltipComponent,
|
||||
GridComponent,
|
||||
LegendComponent,
|
||||
DataZoomComponent,
|
||||
MarkPointComponent,
|
||||
MarkLineComponent,
|
||||
ToolboxComponent,
|
||||
BrushComponent,
|
||||
GeoComponent,
|
||||
VisualMapComponent
|
||||
LegendComponent
|
||||
} from 'echarts/components'
|
||||
|
||||
// 导入渲染器
|
||||
@@ -46,23 +39,12 @@ echarts.use([
|
||||
BarChart,
|
||||
LineChart,
|
||||
PieChart,
|
||||
ScatterChart,
|
||||
RadarChart,
|
||||
MapChart,
|
||||
CandlestickChart,
|
||||
|
||||
// 组件
|
||||
TitleComponent,
|
||||
TooltipComponent,
|
||||
GridComponent,
|
||||
LegendComponent,
|
||||
DataZoomComponent,
|
||||
MarkPointComponent,
|
||||
MarkLineComponent,
|
||||
ToolboxComponent,
|
||||
BrushComponent,
|
||||
GeoComponent,
|
||||
VisualMapComponent,
|
||||
|
||||
// 渲染器
|
||||
CanvasRenderer
|
||||
|
||||
Reference in New Issue
Block a user