react-compound-slider icon indicating copy to clipboard operation
react-compound-slider copied to clipboard

Removing the `d3-array` dependency?

Open pt8o opened this issue 4 years ago • 2 comments

As you can see on Bundlephobia, the package d3-array currently comprises 40% of the total size of react-compound-slider! It's not the heaviest thing in the world but still, lightening the load is never a bad thing.

d3-array is used exactly once: its ticks function is used here https://github.com/sghall/react-compound-slider/blob/b24286d953df08b0ffe508ed5b8bc5741b6068da/src/scales/LinearScale.ts#L1

I wonder if you'd consider extracting just the ticks function so the rest of d3-array doesn't need to be included? https://github.com/d3/d3-array/blob/master/src/ticks.js

pt8o avatar Dec 08 '20 21:12 pt8o

Yeah, this is a fair point. I'm working on a refactor of this code. At the minimum could make it so you could tree shake that code.

sghall avatar Dec 27 '20 20:12 sghall

A problem i've noticed is that the version of d3 being used by react-compound-slider has some arrow functions in it which aren't transpiled. There may be other things that need transpiling too, but an arrrow function is where IE falls over for me. This makes react-compound-slider v3+ incompatible with IE 11. We've had to downgrade too 2.5.0 in order to use this library and remain compatible with IE.

MaxboDev avatar Mar 12 '21 14:03 MaxboDev