Skip to content
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

Expose both created MeiliSearch instance, and the used meilisearch package #1260

Closed
flevi29 opened this issue Oct 5, 2023 · 1 comment · Fixed by #1271
Closed

Expose both created MeiliSearch instance, and the used meilisearch package #1260

flevi29 opened this issue Oct 5, 2023 · 1 comment · Fixed by #1271
Labels
enhancement New feature or request

Comments

@flevi29
Copy link
Collaborator

flevi29 commented Oct 5, 2023

Currently if one wishes to check, for example, the total number of documents on an index, they need to install the meilisearch package as well, and they cannot reuse the already created MeiliSearch instance that @meilisearch/instant-meilisearch creates. This introduces another potential problem, which is that the version which @meilisearch/instant-meilisearch uses and the one that is separately installed is mismatched, resulting in a larger bundle.
This can be avoided by exposing all of meilisearch package from @meilisearch/instant-meilisearch and also exposing the created instance, sort of like how #1258 will expose the search parameters.

@flevi29
Copy link
Collaborator Author

flevi29 commented Dec 16, 2023

I looked into this problem a bit, exposing the created MeiliSearch instance is very easy with #1258 being implemented, however exposing the used meilisearch package is at least a little questionable. I wanted to use the package.json exports field to achieve this, but that would've involved messing with bundling, and also it just flat out wouldn't have worked with UMD. Bummer.

I am considering exposing it in index.ts like so:

export * from './client'
export * from './types'
export * as meilisearch from 'meilisearch'

This shouldn't cause any issues, theoretically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants