Skip to content

Large bundle sizes #616

@coryvirok

Description

@coryvirok

When I import using import { Chart, Axis, ... } form 'layerchart' I'm seeing many additional packages make their way into the build files.

repro: https://stackblitz.com/edit/sveltejs-kit-template-default-skoueh8c?file=.svelte-kit%2Foutput%2Fserver%2Fentries%2Fpages%2F_page.svelte.js

E.g. For my SvelteKit project, when I run npm run build for an app with the following page, you can see the additional imports included in the build results, which I've included the imports for below.

<!-- +page.svelte -->
<script>
  import '../app.css'
  import { scaleBand, scaleOrdinal, scaleTime } from 'd3-scale';

  import { Chart, Layer, Axis, Bars } from 'layerchart'

  import { data } from './data'
	
</script>

<div class="h-[300px] p-4 border rounded-sm">
  <Chart
    {data}
    x="date"
    xScale={scaleBand().padding(0.4)}
    y="value"
    yDomain={[0, null]}
    yNice={4}
    padding={{ left: 16, bottom: 24 }}
  >
    <Layer type="svg">
      <Axis placement="left" grid rule />
      <Axis placement="bottom" rule />
      <Bars strokeWidth={1} class="fill-primary" />
    </Layer>
  </Chart>
</div>
// Top of build file: .svelte-kit/output/server/entries/pages/_page.svelte.js

import "clsx";
import { i as is_array, k as get_prototype_of, o as object_prototype, n as noop, l as deferred, m as hasContext, g as getContext, s as setContext, p as push, q as spread_attributes, t as clsx, u as bind_props, f as pop, v as attr_class, h as escape_html, w as attr, x as stringify, y as props_id, z as attr_style, A as spread_props, B as copy_payload, E as assign_payload, F as ensure_array_like } from "../../chunks/index.js";
import { scaleLinear, scaleSqrt, scaleOrdinal, scaleBand } from "d3-scale";
import { Logger, format, localPoint, sortFunc, unique, isLiteralObject, Duration, DateToken, PeriodType, greatestAbs } from "@layerstack/utils";
import { cls } from "@layerstack/tailwind";
import { get } from "lodash-es";
import { rgb } from "d3-color";
import memoize from "memoize";
import { InternSet, max, min, bisector, extent } from "d3-array";
import { t as state, u as render_effect, n as set, o as get$1 } from "../../chunks/runtime.js";
import { quadtree } from "d3-quadtree";
import { curveLinearClosed, lineRadial, line, pointRadial, arc } from "d3-shape";
import { interpolatePath } from "d3-interpolate-path";
import { objectId } from "@layerstack/utils/object";
import { Delaunay } from "d3-delaunay";
import { geoVoronoi } from "d3-geo-voronoi";
import { geoPath, geoTransform } from "d3-geo";
import { path } from "d3-path";
import { timeTicks, timeYear, timeDay, timeHour, timeMinute, timeSecond, timeMillisecond } from "d3-time";
import "@dagrejs/dagre";
import "d3-tile";
import "d3-sankey";

System details:

  System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 20.19.1 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.8.2 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    d3-scale: ^4.0.2 => 4.0.2 
    layerchart: ^2.0.0-next.27 => 2.0.0-next.33 
    svelte: ^5.25.0 => 5.36.13 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    Up next

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions