cube-js/cube

Reduce bundle size of @cubejs-client

Open

#960 建立於 2020年8月6日

在 GitHub 查看
 (8 留言) (5 反應) (0 負責人)Rust (1,965 fork)batch import
client:corehelp wanted

倉庫指標

Star
 (19,563 star)
PR 合併指標
 (平均合併 5天 16小時) (30 天內合併 138 個 PR)

描述

Is your feature request related to a problem? Please describe. The cube.js client is an awesome way to interact with the server. However, it's rather large for a client side library, with the bulk of the size of it being comprised of dependencies, and half of which come from a single library (moment). There are also polyfills bundled with the library that could be deferred to the user's own browser support needs. This could lead to a large increase in the size of javascript apps that utilize the cube client.

Describe the solution you'd like There are some smaller alternatives to moment that provide the same functionality. dayjs is one of the most popular and is 5% the size. Most of the usage of rambda could be replaced with native ES6 and polyfilled by the user depending on the browsers they support. There may also be value in re-arranging some of the code to allow for tree shaking.

Describe alternatives you've considered The alternative to this would be to interact directly with the server through http. The cube client provides some really useful functionality and would be great to use if it was a little more lightweight. It seems that the core of the package has almost all of the logic and makes up a small percentage of the size.

Additional context Any moment replacement would have to be strenuously tested to make sure that it can parse the same date formats, as users can pass arbitrary strings to moment. Even then, all of the above suggestions would probably be considered breaking. I wanted to see if others have the same concerns and if there was interest in a pull request before I try to create one. Let me know if I completely missed the mark with the above.

I'm really looking forward to working with cube. Reporting has always been a pain point for me and this seems like an excellent solution. Thanks in advance!

貢獻者指南