Open ian-buse opened 1 year ago
Hi
Indeed it's the PR (https://github.com/facebook/docusaurus/pull/8539) that broke it by introducing Algolia-specific things to our theme-common package. Retrospectively that seems like a bad idea @Josh-Cena 😅 we'd rather not couple theme-common to anything apart from our 3 content plugins IMHO (btw the deps has not been added to package.json)
However this breaks because the typesense plugin is using Docusaurus internal implementation details and we can't commit to not do changes that annoy plugins. CC @jasonbosco.
There's also this bug reported on the Typesense repo here: https://github.com/typesense/docusaurus-theme-search-typesense/issues/27
If the API is marked as "internal" you should not use it in your code (in particular in plugin code). I can see our internal generateSearchPageLink()
is used there:
https://github.com/typesense/docusaurus-theme-search-typesense/blob/1678d5364316bc334bbbe51490a08d5fc11d9abf/src/theme/SearchBar/index.tsx#L71
If you need this code, for now, it's safer to copy/paste it and adapt it to your own need rather than using our internal export.
Workaround that probably works: { themeConfig: { algolia: { searchPagePath: "search" } } }
I'll keep this open for now because I think we should remove the theme-common => algolia dependency.
But the refactor will likely break the typesense plugin again 😅. That's also why I'd prefer if the typesense plugin wasn't relying on this internal API @jasonbosco
@slorber Thank you for the heads-up! I essentially forked the built-in Algolia plugin, so I missed noticing that these were internal methods. I've just been regularly syncing the Typesense plugin with upstream changes from the Algolia plugin all these months! 😅
I'll now refactor it to not rely on this internal method. Thank you for the pointers.
I've published 0.9.0
of docusaurus-theme-search-typesense
, which solves the core of this issue.
Have you read the Contributing Guidelines on issues?
Prerequisites
npm run clear
oryarn clear
command.rm -rf node_modules yarn.lock package-lock.json
and re-installing packages.Description
I am running a fresh Docusaurus installation on the latest version (2.3.0), and I've been hitting this error every time I attempt to build my site with the
docusaurus-theme-search-typesense@next
theme.I have a cached older version that I tested this against, and it was able to build successfully. This seems to be an issue with 2.3.0, and I noticed #8539 mentions this
searchPagePath
variable.I wasn't able to get the sandbox to work the way I needed it to, but I've included the repro steps below along with a sample
docusaurus.config.js
.I've included some additional output below showing how I tested this. In the output below, I show I have docusaurus@2.2.0 installed, I installed typesense, and ran a build that succeeded. Then I upgraded Docusaurus, ran a build, and got the error.
Reproducible demo
No response
Steps to reproduce
yarn create docusaurus testdocs classic
docusaurus.config.js
with the one below.yarn add docusaurus-theme-search-typesense@next
cd
to thetestdocs
directoryyarn run build
Expected behavior
A successful build.
Actual behavior
Build failed.
Your environment
Self-service