echarts [Feature] An extension has been customized, but I want to introduce it on demand

n3schb8v  于 2022-12-31  发布在  Echarts
关注(0)|答案(2)|浏览(168)

Version

5.2.2

No response

Steps to Reproduce

I have customized an extension called GLMap , which can put echarts on my map, but now I can only fully introduce echarts, which will make my project package large.

like this

import * as echarts from "echarts"

// do something, like custom my extension

I saw the expansion mode of Baidu map , which is also full. So I want to know what I should do if I introduce it on demand?

Current Behavior

I'm now introducing it on demand:

import "./GLMap";
import * as echarts from "echarts/core";
import { VisualMapComponent } from "echarts/components";
import { CanvasRenderer } from "echarts/renderers";
echarts.use([VisualMapComponent, CanvasRenderer]);

export default echarts;

Although I feel like I don't use VisualMapComponent at all

Expected Behavior

Can be introduced on demand

Environment

- OS: Mac M1
- Browser: Chrome lasted
- Framework: native

Any additional comments?

No response

elcex8rz

elcex8rz1#

Of course, I'm Chinese. In English, I think it might be more friendly in GitHub?

But my English comes from translation software🤪

bfnvny8b

bfnvny8b2#

楼主解决了吗 我也发现了 我的版本是 "echarts": "^5.3.2", 只需要 import * as echarts from 'echarts/core';
就能使用所有功能

压根不用如下配置就能使用所有的 而且引入了如下的跟注释了后大小也没有变化

// import { TitleComponent, TooltipComponent } from 'echarts/components';
// import { EffectScatterChart } from 'echarts/charts';// ScatterChart,
// import { UniversalTransition } from 'echarts/features';
// import { CanvasRenderer } from 'echarts/renderers';

// echarts.use([

//     // TitleComponent,
//     // TooltipComponent,
//     // ScatterChart,
//     // EffectScatterChart,
//     CanvasRenderer,
//     // UniversalTransition
// ]);

相关问题