Expose both created `MeiliSearch` instance, and the used `meilisearch` package
flevi29 opened this issue · comments
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.
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.