question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Avoid bundling @d3/shape

See original GitHub issue

Looking at @primer/components on bundlephobia, it’s massive (40kB min+gzip), and a big part of that is the @d3/shape dependency that is in the core bundle due to being used in the Donut component.

We will most likely not end up using the Donut component, so shipping all that code is a bit of a pain. Is there any chance that the d3 dependency could maybe be loaded asynchronously when needed or that the Donut component gets put into its own bundle?

EDIT: Found a workaround in #456 by importing specific components. It would still be good to see this solved by default.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
broccolinicommented, May 23, 2019

Agree we don’t need it in Primer, this would likely be and app specific component.

If we do end up developing components that are useful for some GitHub apps and increase bundle size but also often not needed, then we could make an “addons” library so that folks can decide what to pull in or not. I don’t think we need to go down the path we did with Primer CSS but addons could be a good option to consider in future if needed.

1reaction
shawnbotcommented, May 21, 2019

I think this is a good candidate for pulling out into a separate bundle. In Primer CSS land this would be a “product” style rather than a “core” style; maybe we should have a @primer/components/product bundle? /cc @broccolini

Read more comments on GitHub >

github_iconTop Results From Across the Web

d3/d3-shape: Graphical primitives for visualization ... - GitHub
For legacy environments, you can load d3-shape's UMD bundle; a d3 global ... Centripetal splines are recommended to avoid self-intersections and overshoot.
Read more >
D3.js Edge Bundling without Hierachy - Stack Overflow
Holten's hierarchical edge bundling algorithm in D3 depends on hierarchical data. ... Is there a way to implement a similar circular edge bundling...
Read more >
Why I no longer use D3.js - Medium
Depending on the type of chart and how much tree-shaking can optimise your bundle, D3 at worst will be importing 70+ KB of...
Read more >
d3-shape - Expert Data Visualization-5309 - O'Reilly Resources
As with other aspects of D3, these shapes are driven by data: each shape generator ... visualization types, such as the links in...
Read more >
Changes in D3 4.0 - Calibro
If you don't care about modularity, you can mostly ignore this change and keep using the default bundle. However, there is one unavoidable...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found