You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@echarts.apache.org by GitBox <gi...@apache.org> on 2018/05/24 03:07:12 UTC

[GitHub] ceerqingting opened a new issue #8392: 中国地图无法按需加载,需要手动修改china.js

ceerqingting opened a new issue #8392: 中国地图无法按需加载,需要手动修改china.js
URL: https://github.com/apache/incubator-echarts/issues/8392
 
 
   <!--
   为了方便我们能够复现和修复 bug,请遵从下面的规范描述您的问题。
   -->
   
   
   ### One-line summary [问题简述]
   
   按需加载echart中国地图,发现只要引入了china.js,按需加载无效,所有的内容都被引用进来
   
   ### Version & Environment [版本及环境]
   "webpack": "^3.6.0"
   + ECharts version [ECharts 版本]:
    "echarts": "^4.0.4"
   
   china.js 源码:
   
   ```javascript
   (function (root, factory) {
       if (typeof define === 'function' && define.amd) {
           // AMD. Register as an anonymous module.
           define(['exports', 'echarts'], factory);
       } else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
           // CommonJS
           factory(exports, require('echarts'));
       } else {
           // Browser globals
           factory({}, root.echarts);
       }
   }(this, function (exports, echarts) {
      echarts.registerMap()
   })
   ```
   
   修改后:
   ```javascript
   const echarts = require('echarts/lib/echarts')
    echarts.registerMap()
   ```
   ### Expected behaviour [期望结果]
   
   无需手动修改配置
   
   ### ECharts option [ECharts配置项]
   <!-- Copy and paste your 'echarts option' here. -->
   <!-- [下方贴你的option,注意不要删掉下方 ```javascript 和 尾部的 ``` 字样。最好是我们能够直接运行的 option。如何得到能运行的 option 参见上方的 guidelines for contributing] -->
   ```javascript
   const echarts = require('echarts/lib/echarts')
   
   require('echarts/lib/chart/line')
   
   require('echarts/lib/chart/bar')
   
   require('echarts/lib/chart/pictorialBar')
   
   require('echarts/lib/chart/pie')
   
   require('echarts/lib/chart/scatter')
   
   require('echarts/lib/chart/effectScatter')
   
   require('echarts/lib/chart/map')
   
   require('echarts/lib/component/grid')
   
   require('echarts/lib/component/tooltip')
   
   require('echarts/lib/component/axisPointer')
   
   require('echarts/lib/component/geo')
   
   require('echarts/lib/component/visualMap')
   
   require('echarts/lib/component/toolbox')
   
   export default echarts
   ```
   
   
   
   
   ### Other comments [其他信息]
   <!-- For example: Screenshot or Online demo -->
   <!-- [例如,截图或线上实例 (JSFiddle/JSBin/Codepen)] -->
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@echarts.apache.org
For additional commands, e-mail: dev-help@echarts.apache.org