layerchart icon indicating copy to clipboard operation
layerchart copied to clipboard

Split components by context to reduce bundle size

Open techniq opened this issue 7 months ago • 0 comments

In many cases, a component is only used within a <Svg> or <Canvas> context. While it's very convenient to have a single component that works across all contexts, it does increase bundle size to load the Svg or Canvas implementations for all components when you are only using one of them.

The proposal is to still provide a unified component, but also provide context-specific instances, such as:

  • Text
    • simple facade that uses the the below
  • TextSvg
  • TextCanvas
  • TextHtml (future)
  • TextBase (possible to simplify the aforementioned)

This should significantly reduce bundle sizes. Will take some thought on how to do this surgically.

techniq avatar Jun 11 '25 14:06 techniq