antvis / data-set

state driven all in one data process for data visualization.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

the JS bundle built from this tool is so large

orangeyyy opened this issue · comments

I only use the tranform of this tool, but I found the js bundle built from this tool is so large:
without uglify:
image
with uglify:
image

could you do some code splitting for this tool?

You can use connectors or transforms independently by require the source file directly. For example, if you only need to handle hexjson files, you can use data-set like this:

import '@antv/data-set/src/connector/hexjson';
import DataSet from '@antv/data-set/src/data-set';

const dv = new DataSet.View().source(data, {
  type: 'hex',
  width: 100,
  height: 100
});

In fact, ALL connectors and transforms are Pluggable. https://github.com/antvis/data-set/blob/master/index.js

got it. THX

您好,我使用import DataSet from '@antv/data-set/src/data-set';这种方式按需加载,会报错,提示transform is not a function,现在只能全量引入么?

@ChiaJune 引用这个文件: https://github.com/antvis/data-set/blob/master/src/index.js 如果需要按需引用,也参考这个文件的写法,只是相对路径写成绝对路径(require('./api/statistics'); -> require('@antv/data-set/src/api/statistics');)

请问什么时候支持按需引入呢。。引用data-set包的部分功能,还得一个一个从src目录下引入,这样每次build之前还得额外用babel处理一下才能uglify😢😢

@ChiaJune 引用这个文件: https://github.com/antvis/data-set/blob/master/src/index.js 如果需要按需引用,也参考这个文件的写法,只是相对路径写成绝对路径(require('./api/statistics'); -> require('@antv/data-set/src/api/statistics');)

现在可以参考 https://github.com/antvis/data-set/blob/master/src/index.ts

您好,我使用import DataSet from '@antv/data-set/src/data-set';这种方式按需加载,会报错,提示transform is not a function,现在只能全量引入么?

请问您最后怎么解决的?

@sameenzm
Example from my project:

// load used codes only
// https://github.com/antvis/data-set/blob/master/src/index.ts
import '@antv/data-set/lib/connector/default';
import '@antv/data-set/lib/transform/fold';
import { DataSet } from "@antv/data-set/lib/data-set";