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/25 12:19:21 UTC

[GitHub] [echarts] lz1998 opened a new issue #14351: Install themes from npm

lz1998 opened a new issue #14351:
URL: https://github.com/apache/echarts/issues/14351


   ### What problem does this feature solve?
   I want to develop a node.js program to generate echarts image file. ([ssr-echarts](https://github.com/lz1998/ssr-echarts))
   There is a theme npm package in echarts4 ([echarts-themes-js](https://www.npmjs.com/package/echarts-themes-js)), but I can't find one for echarts5.
   Some default themes are enough.
   
   我想开发一个nodejs程序生成echarts图片([ssr-echarts](https://github.com/lz1998/ssr-echarts))。
   在echarts4,有一个echarts theme的npm包([echarts-themes-js](https://www.npmjs.com/package/echarts-themes-js)),但是echarts5找不到npm主题包。
   只要默认主题就可以。
   
   ### What does the proposed API look like?
   https://www.npmjs.com/package/echarts-themes-js
   
   <!-- This issue is generated by echarts-issue-helper. DO NOT REMOVE -->
   <!-- This issue is in English. DO NOT REMOVE -->


----------------------------------------------------------------
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


[GitHub] [echarts] lz1998 commented on issue #14351: Install themes from npm

Posted by GitBox <gi...@apache.org>.
lz1998 commented on issue #14351:
URL: https://github.com/apache/echarts/issues/14351#issuecomment-787249306


   > Yes, it will be great. But we may need to provide separate ESM modules for themes that can be installed manually.
   
   When will the themes modules be provided?


----------------------------------------------------------------
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


[GitHub] [echarts] plainheart commented on issue #14351: Install themes from npm

Posted by GitBox <gi...@apache.org>.
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**
   
   ![current](https://user-images.githubusercontent.com/26999792/109239715-152d4e80-7811-11eb-8600-a9cf7cea5bbf.png)
   
   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**
   
   ![image](https://user-images.githubusercontent.com/26999792/109240602-b537a780-7812-11eb-95de-d7b5bd97d6fa.png)
   
   #### 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


[GitHub] [echarts] pissang commented on issue #14351: Install themes from npm

Posted by GitBox <gi...@apache.org>.
pissang commented on issue #14351:
URL: https://github.com/apache/echarts/issues/14351#issuecomment-786375482


   > 1) The current UMD header invalidates tree-shaking, which makes the bundled size larger.
   
   Because `echarts/lib/echarts` is not an AMD module. So I still use `echarts` in the AMD branch. Didn't know the bundler will still go into the AMD branch. This change is very neat and helpful.
   
   
   > Perhaps, we should also make the theme or extension installable.
   
   Yes, it will be great. But we may need to provide separate ESM modules for themes that can be installed manually.


----------------------------------------------------------------
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


[GitHub] [echarts] plainheart edited a comment on issue #14351: Install themes from npm

Posted by GitBox <gi...@apache.org>.
plainheart edited a comment 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**
   
   ![current](https://user-images.githubusercontent.com/26999792/109239715-152d4e80-7811-11eb-8600-a9cf7cea5bbf.png)
   
   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**
   
   ![image](https://user-images.githubusercontent.com/26999792/109240602-b537a780-7812-11eb-95de-d7b5bd97d6fa.png)
   
   ### 2) For themes / bmap extension 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.
   
   Perhaps, we should also make the theme or extension installable.
   
   
   


----------------------------------------------------------------
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


[GitHub] [echarts] lz1998 commented on issue #14351: Install themes from npm

Posted by GitBox <gi...@apache.org>.
lz1998 commented on issue #14351:
URL: https://github.com/apache/echarts/issues/14351#issuecomment-785910246


   I replace `factory(exports, require('echarts/lib/echarts'));` to `factory(exports, require('echarts'));` in node_modules/echarts/theme/*, then the problem is fixed。


----------------------------------------------------------------
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


[GitHub] [echarts] plainheart edited a comment on issue #14351: Install themes from npm

Posted by GitBox <gi...@apache.org>.
plainheart edited a comment 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**
   
   ![current](https://user-images.githubusercontent.com/26999792/109239715-152d4e80-7811-11eb-8600-a9cf7cea5bbf.png)
   
   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**
   
   ![image](https://user-images.githubusercontent.com/26999792/109240602-b537a780-7812-11eb-95de-d7b5bd97d6fa.png)
   
   ### 2) For themes / bmap extension 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


[GitHub] [echarts] plainheart edited a comment on issue #14351: Install themes from npm

Posted by GitBox <gi...@apache.org>.
plainheart edited a comment 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**
   
   ![current](https://user-images.githubusercontent.com/26999792/109239715-152d4e80-7811-11eb-8600-a9cf7cea5bbf.png)
   
   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**
   
   ![image](https://user-images.githubusercontent.com/26999792/109240602-b537a780-7812-11eb-95de-d7b5bd97d6fa.png)
   
   #### 2) For themes / bmap extension 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


[GitHub] [echarts] lz1998 commented on issue #14351: Install themes from npm

Posted by GitBox <gi...@apache.org>.
lz1998 commented on issue #14351:
URL: https://github.com/apache/echarts/issues/14351#issuecomment-785905520


   I have tries import theme from echarts/theme, but an error occured
   
   ```bash
   /Users/lz1998/WebstormProjects/ssr-echarts/node_modules/echarts/lib/echarts.js:44
   export * from './export/core';
   ^^^^^^
   
   SyntaxError: Unexpected token 'export'
       at wrapSafe (internal/modules/cjs/loader.js:1054:16)
       at Module._compile (internal/modules/cjs/loader.js:1102:27)
       at Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
       at Object.require.extensions.<computed> [as .js] (/Users/lz1998/WebstormProjects/ssr-echarts/node_modules/ts-node/src/index.ts:1045:43)
       at Module.load (internal/modules/cjs/loader.js:986:32)
       at Function.Module._load (internal/modules/cjs/loader.js:879:14)
       at Module.require (internal/modules/cjs/loader.js:1026:19)
       at require (internal/modules/cjs/helpers.js:72:18)
       at /Users/lz1998/WebstormProjects/ssr-echarts/node_modules/echarts/theme/macarons.js:29:26
       at Object.<anonymous> (/Users/lz1998/WebstormProjects/ssr-echarts/node_modules/echarts/theme/macarons.js:34:3)
   
   ```


----------------------------------------------------------------
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


[GitHub] [echarts] plainheart commented on issue #14351: Install themes from npm

Posted by GitBox <gi...@apache.org>.
plainheart commented on issue #14351:
URL: https://github.com/apache/echarts/issues/14351#issuecomment-786379070


   > Because echarts/lib/echarts is not an AMD module.
   
   Never notice it before. Thank you for pointing out.


----------------------------------------------------------------
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


[GitHub] [echarts] echarts-bot[bot] commented on issue #14351: Install themes from npm

Posted by GitBox <gi...@apache.org>.
echarts-bot[bot] commented on issue #14351:
URL: https://github.com/apache/echarts/issues/14351#issuecomment-785855039






----------------------------------------------------------------
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