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

Docusuarus V2 Fails to build when using Docusaurus Search Local #83

Closed astrawnuts closed 2 years ago

astrawnuts commented 2 years ago

Bug description

Reproduction

Public Repo Link: https://github.com/astrawnuts/Docusaurus-NEW-Local-Search

Just to prove that docusaurus search local was the cause of the failed project build I setup a new docusaurus website using the create command for V2 Beta 13 and installed docusaurus search local. Changed the docusaurus config file and tried to build.

The following error was shown

$ DEBUG=1 yarn build
yarn run v1.22.15
warning ..\package.json: No license field
$ docusaurus build

[en] Creating an optimized production build...
Unable to build website for locale "en".
TypeError: (0 , utils_1.readDefaultCodeTranslationMessages) is not a function
    at Object.getDefaultCodeTranslationMessages (S:\Files\VS_Code\Projects\docs_v3\my-website\node_modules\@cmfcmf\docusaurus-search-local\lib\server\index.js:148:97)
    at S:\Files\VS_Code\Projects\docs_v3\my-website\node_modules\@docusaurus\core\lib\server\translations\translations.js:174:186
    at Array.map (<anonymous>)
    at getPluginsDefaultCodeTranslationMessages (S:\Files\VS_Code\Projects\docs_v3\my-website\node_modules\@docusaurus\core\lib\server\translations\translations.js:174:55)
    at load (S:\Files\VS_Code\Projects\docs_v3\my-website\node_modules\@docusaurus\core\lib\server\index.js:240:79)
    at async buildLocale (S:\Files\VS_Code\Projects\docs_v3\my-website\node_modules\@docusaurus\core\lib\commands\build.js:82:19)
    at async tryToBuildLocale (S:\Files\VS_Code\Projects\docs_v3\my-website\node_modules\@docusaurus\core\lib\commands\build.js:34:20)
    at async mapAsyncSequencial (S:\Files\VS_Code\Projects\docs_v3\my-website\node_modules\@docusaurus\utils\lib\index.js:262:24)
    at async build (S:\Files\VS_Code\Projects\docs_v3\my-website\node_modules\@docusaurus\core\lib\commands\build.js:70:25)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

If possible, provide a link to the source of your documentation or at least the document/page this issue is about (if applicable). If this bug report is about a failure that occurs while building your documentation, please find out which document breaks the build process by building your documentation with debug information enabled as described in the README (DEBUG=1 yarn build). If you can, provide the document that breaks the build process as indicated by the debug messages.

Environment

Package Versions

If you use Yarn: yarn list --pattern '@docusaurus|@cmfcmf' --depth=0 If you use npm: npm list '@docusaurus/core' '@cmfcmf/docusaurus-search-local'

$  yarn list --pattern '@docusaurus|@cmfcmf' --depth=0
yarn list v1.22.15
warning ..\package.json: No license field
├─ @cmfcmf/docusaurus-search-local@0.8.0
├─ @docusaurus/core@2.0.0-beta.13
├─ @docusaurus/cssnano-preset@2.0.0-beta.13
├─ @docusaurus/mdx-loader@2.0.0-beta.13
├─ @docusaurus/plugin-content-blog@2.0.0-beta.13
├─ @docusaurus/plugin-content-docs@2.0.0-beta.13
├─ @docusaurus/plugin-content-pages@2.0.0-beta.13
├─ @docusaurus/plugin-debug@2.0.0-beta.13
├─ @docusaurus/plugin-google-analytics@2.0.0-beta.13
├─ @docusaurus/plugin-google-gtag@2.0.0-beta.13
├─ @docusaurus/plugin-sitemap@2.0.0-beta.13
├─ @docusaurus/preset-classic@2.0.0-beta.13
├─ @docusaurus/react-loadable@5.5.2
├─ @docusaurus/theme-classic@2.0.0-beta.13
├─ @docusaurus/theme-common@2.0.0-beta.13
├─ @docusaurus/theme-search-algolia@2.0.0-beta.13
├─ @docusaurus/theme-translations@2.0.0-beta.13
├─ @docusaurus/utils-common@2.0.0-beta.13
├─ @docusaurus/utils-validation@2.0.0-beta.13
└─ @docusaurus/utils@2.0.0-beta.13
Done in 0.88s.

Node Version

node -v

$ node -v v16.13.0

Docusaurus Environment

Additional context

astrawnuts commented 2 years ago

Update #2: Same bug occurs on my other github repo using Docusaurus and local search plugin

cmfcmf commented 2 years ago

Thank you for reporting this. Should be fixed in v0.9.0.