Choices icon indicating copy to clipboard operation
Choices copied to clipboard

Choices is not treeshakeble

Open jpx40 opened this issue 10 months ago • 2 comments

I experience that choices is not treeshakble with esbuild, even if i just use a bareminimum of the libary, still everything is still imported. I guess this is because choices uses classes internally, which are compared to bare functions not really good in optimizing unused functions away.

I wanted to ask if some part could be outsourced to functions from the main class.

jpx40 avatar Feb 19 '25 21:02 jpx40

The search functionality can be tree-shaken out (this is how choices.search-basic.js/choices.search-prefix.js are built), anything finer grain is very difficult without major rework to support per-feature tree shaking

Xon avatar Feb 22 '25 10:02 Xon

maybe u could use a plugin system to keep the base class small. And extend every new feature via a Plugin or an Subclass.

jpx40 avatar Feb 22 '25 12:02 jpx40