cmfcmf / docusaurus-search-local

Offline / Local Search for Docusaurus v2. Try it live at:
https://cmfcmf.github.io/OpenWeatherMap-PHP-API/
MIT License
438 stars 67 forks source link

[Bug] Error: Can't resolve '@theme/hooks/useDocs' #93

Closed homotechsual closed 2 years ago

homotechsual commented 2 years ago

Please describe the bug you are seeing

Can't build with canary using this plugin. Looks like useDocs has been replaced by @docusaurus/plugin-content-docs/client.

https://github.com/facebook/docusaurus/pull/6287

How can we best reproduce the bug?

No response

Which version of Docusaurus and @cmfcmf/docusaurus-search-local are you using?

@cmfcmf/docusaurus-search-local@0.9.4 @docusaurus/core@0.0.0-4470

Which Node.js version are you using?

v16.13.2

Which theme are you using?

Yes, I am using @docusaurus/theme-classic

How does your plugin config look like?

require.resolve("@cmfcmf/docusaurus-search-local"), { indexDocs: true, indexBlog: false, indexPages: true, language: "en" }

Additional context

No response

pklaschka commented 2 years ago

I can confirm this. It breaks when updating @docusaurus/preset-classic from 2.0.0-beta.14 to 2.0.0-beta.15.

According to their changelog, the hooks were moved from @theme/hooks to @docusaurus/theme-common:

docusaurus-theme-classic, docusaurus-theme-common, docusaurus-theme-live-codeblock, docusaurus-theme-search-algolia

6289 refactor: move @theme/hooks to @docusaurus/theme-common

(linking to https://github.com/facebook/docusaurus/pull/6289)

edumaciel10 commented 2 years ago

I am getting the same error here

slorber commented 2 years ago

Hi

This hook is considered an internal API, can you explain how it is used?

Are there other internal apis that you are using?

cmfcmf commented 2 years ago

This hook is considered an internal API, can you explain how it is used?

The use of this hook was a remnant of when useContextualSearchFilters was not yet available in @docusaurus/theme-common. I now dropped support for older Docusaurus versions and removed the use of these internal APIs.

Are there other internal apis that you are using?

I am not 100% sure :) It definitely feels like I am using less and less internal APIs with each new beta of Docusaurus.

cmfcmf commented 2 years ago

Fixed in v0.10.0.

pklaschka commented 2 years ago

@cmfcmf Thank you for the quick fix!

slorber commented 2 years ago

great, thanks :)

Let me know if you have a use-case for another internal API in the future