Code Monkey home page Code Monkey logo

Comments (9)

hustcc avatar hustcc commented on May 17, 2024

#3,暂时没有想到比较好的方案,既能保证稳定性,又能保证兼容性。

个人想法是:

  1. 保持目前的 ReactEcharts 实例使用方式;
  2. 另外还提供 Line、Bar 等不同的 export 来单独引入不同的 echarts 模块,减少代码量。

from echarts-for-react.

benweizhu avatar benweizhu commented on May 17, 2024

我发现,有很大的一个数据来自于地图的China.js或者world.js,如果有require

from echarts-for-react.

hustcc avatar hustcc commented on May 17, 2024

China.js 或者 world.js 默认是没有加入到 echarts 的,需要自己手动引入。

from echarts-for-react.

SidKwok avatar SidKwok commented on May 17, 2024

可以用peerDependency的方法,让用户引入echarts,那样子就可以让用户自定义需要引入的地图类型了

from echarts-for-react.

hustcc avatar hustcc commented on May 17, 2024

理论上 echarts 确实是 peerDependency,package.json 也应该修改。

但是修改为 peerDependency 并不能解决打包太大的问题吧?

from echarts-for-react.

SidKwok avatar SidKwok commented on May 17, 2024

@hustcc 其实我的意思是,你在项目里面直接引入了echarts啊,你可以不引入,然后让用户自己引入,所以就变成了:

import echarts from 'echarts';
import Chart from 'echarts-for-react';

<Chart echarts={echarts} />

这样子用户应该就可以自定义echarts的地图类型了

from echarts-for-react.

hustcc avatar hustcc commented on May 17, 2024

能够兼容现在的写法吗?比如用户不在乎 echarts 的大小,可以继续保持以前的写法。

from echarts-for-react.

SidKwok avatar SidKwok commented on May 17, 2024

@hustcc 我想想 然后提一份pr给你看看

from echarts-for-react.

hustcc avatar hustcc commented on May 17, 2024

v1.3.5 版本发布,支持自定义加载 echarts 模块,减少打包之后的 js 文件大小,感谢 @SidKwok

from echarts-for-react.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.