askorama / orama

🌌 Fast, dependency-free, full-text and vector search engine with typo tolerance, filters, facets, stemming, and more. Works with any JavaScript runtime, browser, server, service!
https://docs.askorama.ai
Other
8.27k stars 273 forks source link

Docusaurus V3 plugin not working on fresh install #728

Open dusanbobicic opened 3 weeks ago

dusanbobicic commented 3 weeks ago

Describe the bug

First we tried integrating the OSS version of the plugin on the existing solution instead of lunr search plugin but we got an error. To verify that the issue is with the orama plugin we've tried on a fresh docusaurus project and it did not work. We are getting some react errors. See the image below: image

Error link

When we run the website in development mode using: npm run start We get a following error which describes more the minified issue:

Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Check the render method of `OramaSearchWithDocs`.

Thanks for taking your time!

To Reproduce

  1. Initialize fresh docusaurus project. It will create a docusaurus 3.4.0 site
  2. Build the website, to verify that docusaurus works. It works.
  3. Clear the build and cache folders
  4. Install orama docusaurus V3 plugin
  5. Add the plugin to docusaurus.config.ts
  6. Run npm run build
  7. Run npm run serve

Expected behavior

Site is built and docusaurus website is rendered with search box.

Environment Info

OS: Windows 11
Node: v20.10.0
Orama Plugin Version: 2.0.19
Docusaurus: 3.4.0

Affected areas

Initialization, Search

Additional context

No response

avb-is-me commented 3 weeks ago

@dusanbobicic hopefully a fix gets pushed soon, but I got it to work with npm run swizzle.

I was able to get orama working with docusaurus 3.4.0, by using npm swizzle and ejecting: and then i updated @orama/searchbox, and then setting @orama/searchbox in my package.json to an older version at 1.0.0-rc33

Screenshot 2024-06-06 at 2 57 43 PM