algolia / docsearch

:blue_book: The easiest way to add search to your documentation.
https://docsearch.algolia.com
MIT License
3.92k stars 381 forks source link

Publish @docsearch/preact package alongside @docsearch/react #1063

Open ElMassimo opened 2 years ago

ElMassimo commented 2 years ago

Describe the problem

Using docsearch directly with Preact currently requires manual configuration.

For example, using @docsearch/react in Vite.js projects requires manual fiddling to replace require("react") with require("preact/compat").

Describe the solution

Publish a @docsearch/preact package that uses the same setup as @docsearch/js to replace react with preact.

@docsearch/js could depend on @docsearch/preact directly instead.

Haroenv commented 2 years ago

In the mean time, is there a reason you can't / don't want to use @docsearch/js?

ElMassimo commented 2 years ago

@Haroenv I was using @docsearch/js, but ergonomics are better if you can use the components directly.

It's a nice-to-have, but it seems reasonable 😃

shortcuts commented 2 years ago

For example, using @docsearch/react in Vite.js projects requires manual fiddling to replace require("react") with require("preact/compat").

Easing the Vue integrations is the missing part of releasing the stable v3 IMO.

I was using @docsearch/js, but ergonomics are better if you can use the components directly.

Ideally, I think we would like provide a VDOM uncontrolled solution (like we did on Recommend for example), but your solution also seems like an easy step 🤔

Haroenv commented 2 years ago

FYI @shortcuts Vite isn't exclusive to Vue, it can just as well be used in a Preact site, like done here

shortcuts commented 2 years ago

FYI @shortcuts Vite isn't exclusive to Vue, it can just as well be used in a Preact site, like done here

Yes indeed, I was referring to Vue because it's the "harder to implement DocSearch with"