algolia / instantsearch

⚡️ Libraries for building performant and instant search and recommend experiences with Algolia. Compatible with JavaScript, TypeScript, React and Vue.
https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/js/
MIT License
3.73k stars 525 forks source link

fix(dependencies): replace qs by neoqs #6291

Open Haroenv opened 4 months ago

Haroenv commented 4 months ago

Summary

Replace qs by neoqs. This doesn't have a bundlesize change, but it avoids us ever accidentally updating qs and having a big bump

Result

neoqs is API-compatible with qs in the legacy mode, and thus this isn't a breaking change. Of course if someone was already using qs and relying on it being deduplicated with the InstantSearch version.

URLs parsed and created by qs and neoqs are compatible

codesandbox-ci[bot] commented 4 months ago

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 9f92e8c3b7fd59e23e3336ba0ffb109bad9a72f1:

Sandbox Source
example-instantsearch-getting-started Configuration
example-react-instantsearch-getting-started Configuration
example-react-instantsearch-next-app-dir-example Configuration
example-react-instantsearch-next-routing-example Configuration
example-vue-instantsearch-getting-started Configuration
Haroenv commented 4 months ago

Hmm bundle size is larger, doesn't seem to be due to non-working deduplication, maybe other features added since qs@6.9.7? cc @puruvjdev is this expected?

PuruVJ commented 4 months ago

Hmm bundle size is larger, doesn't seem to be due to non-working deduplication, maybe other features added since qs@6.9.7? cc @puruvjdev is this expected?

I am looking at bundlephobia to see if that's the case, but it seems to be down. I'll let you know if that's the case.

EDIT: well, its after 6.9.7 only that the library went crazy

CleanShot 2024-07-23 at 19 22 54

PuruVJ commented 4 months ago

Well the real thing is that /legacy is compiled to ES5, so it does add an extra 400bytes(min+br). That is the additional size we're seeing here. This is done so even very old libs and apps can use neoqs and avoid dependency hell. Also, there have been some additional features since 6.9.7 which do account for a few extra bytes here.

Only way the size would go down is by using the default build, which is ESM-only.

I'd suggest using neoqs/legacy now with the extra 1KB, if it's not too much, but whenever in future you decide to drop CJS support, switch to neoqs/modern(It's gonna be 3.4KB only 👀, releasing sometime next week).

Lemme know if that helps. And thanks for considering this lib

PuruVJ commented 3 months ago

Any update on this? 😁