Skip to content

Choices is not treeshakeble #1267

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jpx40 opened this issue Feb 19, 2025 · 2 comments
Open

Choices is not treeshakeble #1267

jpx40 opened this issue Feb 19, 2025 · 2 comments

Comments

@jpx40
Copy link

jpx40 commented Feb 19, 2025

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.

@Xon
Copy link
Collaborator

Xon commented Feb 22, 2025

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

@jpx40
Copy link
Author

jpx40 commented Feb 22, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants