Hacker News new | ask | show | jobs
by azangru 1837 days ago
So, is d3 tree-shakeable yet? If I import { scaleLinear } from 'd3' in a webpack-built project, will I get only the scaleLinear code? As far as I remember, in v6 this will import a lot of (or perhaps the rest of) d3 as well.
1 comments

You can also just import it from d3-scale.
Yeah, I know.

I am probably being unreasonable; but it's kind of nice to be able to have a single third-party dependency out of which you can pick what you need at the moment, rather than a host of small third-party dependencies. Kind of like lodash, from which you can at least import individual functions (import merge from 'lodash/merge') rather than installing all those functions as individual packages.

I agree with you and wish that were an option, but I do think most build tools will tree shake for you nowadays.