algolia / docsearch

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

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

Open ElMassimo opened 3 years ago

ElMassimo commented 3 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 3 years ago

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

ElMassimo commented 3 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 3 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 3 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 3 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"