Avoid bundling @d3/shape
See original GitHub issueLooking 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:
- Created 4 years ago
- Comments:6 (6 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
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