You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2021/02/26 01:18:28 UTC
[GitHub] [echarts] plainheart commented on issue #14351: Install themes from npm
plainheart commented on issue #14351:
URL: https://github.com/apache/echarts/issues/14351#issuecomment-786341558
I'm thinking it might be better to use `echarts/lib/echarts` if we need tree-shaking.
This issue reminds me of another issue to look into. The current UMD header seems to make tree-shaking invalid.
@pissang There are several questions about this
#### 1) The current UMD header invalidates tree-shaking, which makes the bundled size larger.
**This is bundled result with the current UMD header**

the module dependency in AMD seems incorrect, it may be also `echarts/lib/echarts`.
Besides, it would be better to increase the priority of `commonjs`, just like what `rolllup` generates.
```js
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('echarts/lib/echarts')) :
typeof define === 'function' && define.amd ? define(['exports', 'echarts/lib/echarts'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory({}, global.echarts));
}(this, (function (exports, echarts) {
// ...
})));
```
**This is bundled result with the tweaked UMD header**

#### 2) For themes and bmap or other plugins, should we import `echarts/lib/echarts` or `echarts/core`?
We can see `echarts/lib/echarts` is importing `CanvasRenderer` & `DatasetComponent`, but they are unnecessary if only SVG renderer is needed and no dataset is used. Especially theme files, they only need to import core library.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org