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

Build breaks with "trailingSlash: false" #52

Closed sdirix closed 2 years ago

sdirix commented 3 years ago

Bug description

Hi! Recently the Docusaurus team introduced a new configuration option trailingSlash: boolean | undefined, see here.

When specifying trailingSlash: false and using "@cmfcmf/docusaurus-search-local": "^0.6.2" the Docusaurus build breaks.

Reproduction

Add trailingSlash: false to the Docusaurus config

Error message:

[Local Search] [INFO]: Gathering documents
[Local Search] [INFO]: Parsing documents
[Local Search] [DEBUG]: Parsing blog file /build/blog/hello-world/index.html (url: /blog/hello-world)
[Local Search] [DEBUG]: Parsing blog file /build/blog/hola/index.html (url: /blog/hola)
[Local Search] [DEBUG]: Parsing blog file /build/blog/welcome/index.html (url: /blog/welcome)
[Local Search] [DEBUG]: Parsing docs file /build/docs/intro/index.html (url: /docs/intro)
[Local Search] [DEBUG]: Parsing docs file /build/docs/tutorial-basics/congratulations/index.html (url: /docs/tutorial-basics/congratulations)
[Local Search] [DEBUG]: Parsing docs file /build/docs/tutorial-basics/create-a-blog-post/index.html (url: /docs/tutorial-basics/create-a-blog-post)
[Local Search] [DEBUG]: Parsing docs file /build/docs/tutorial-basics/create-a-document/index.html (url: /docs/tutorial-basics/create-a-document)
[Local Search] [DEBUG]: Parsing docs file /build/docs/tutorial-basics/create-a-page/index.html (url: /docs/tutorial-basics/create-a-page)
[Local Search] [DEBUG]: Parsing docs file /build/docs/tutorial-basics/deploy-your-site/index.html (url: /docs/tutorial-basics/deploy-your-site)
[Local Search] [DEBUG]: Parsing docs file /build/docs/tutorial-basics/markdown-features/index.html (url: /docs/tutorial-basics/markdown-features)
[Local Search] [DEBUG]: Parsing docs file /build/docs/tutorial-extras/manage-docs-versions/index.html (url: /docs/tutorial-extras/manage-docs-versions)
[Local Search] [DEBUG]: Parsing docs file /build/docs/tutorial-extras/translate-your-site/index.html (url: /docs/tutorial-extras/translate-your-site)
Unable to build website for locale "en".
Error: ENOENT: no such file or directory, open '/build/blog/hello-world/index.html'
error Command failed with exit code 1.

You can reproduce the issue on this branch.

Environment

Package Versions

├─ @cmfcmf/docusaurus-search-local@0.6.2
├─ @docusaurus/core@2.0.0-beta.3
├─ @docusaurus/cssnano-preset@2.0.0-beta.3
├─ @docusaurus/mdx-loader@2.0.0-beta.3
├─ @docusaurus/plugin-content-blog@2.0.0-beta.3
├─ @docusaurus/plugin-content-docs@2.0.0-beta.3
├─ @docusaurus/plugin-content-pages@2.0.0-beta.3
├─ @docusaurus/plugin-debug@2.0.0-beta.3
├─ @docusaurus/plugin-google-analytics@2.0.0-beta.3
├─ @docusaurus/plugin-google-gtag@2.0.0-beta.3
├─ @docusaurus/plugin-sitemap@2.0.0-beta.3
├─ @docusaurus/preset-classic@2.0.0-beta.3
├─ @docusaurus/react-loadable@5.5.0
├─ @docusaurus/theme-classic@2.0.0-beta.3
├─ @docusaurus/theme-common@2.0.0-beta.3
├─ @docusaurus/theme-search-algolia@2.0.0-beta.3
├─ @docusaurus/types@2.0.0-beta.3
├─ @docusaurus/utils-common@2.0.0-beta.3
├─ @docusaurus/utils-validation@2.0.0-beta.3
└─ @docusaurus/utils@2.0.0-beta.3

Node Version

Docusaurus Environment

Additional context

cmfcmf commented 3 years ago

Thank you for bringing this up! I have released a fix as part of 0.6.3.

marcelmerkx commented 2 years ago

hi @cmfcmf , could it be this issue regressed?

trailingSlash=false :

Unable to build website for locale "en".
Error: ENOENT: no such file or directory, open 'C:\Users\ABCD\Documents\Development\ABCXYZ-dev-docs\build\.html'
error Command failed with exit code 1.

trailingSlash=true --> works like a charm!

cmfcmf commented 2 years ago

hi @cmfcmf , could it be this issue regressed?

You're right! I fixed it again, and this time I also added example docs with trailingSlash: false to CI, so that it will hopefully not come up again. I will release v0.9.2 with this fix shortly.

marcelmerkx commented 2 years ago

@cmfcmf thanks Christian, awesome speed for fixing. totally works!