After installing the plugin, command npm run write-translations fails with:
lorenzo@dev01:~/help$ npm run write-translations
> help@0.0.0 write-translations
> docusaurus write-translations
[ERROR] Error while attempting to extract Docusaurus translations from source code file at "node_modules/@cmfcmf/docusaurus-search-local/lib/client/theme/SearchBar/generated.d.ts".
[ERROR] SyntaxError: /home/lorenzo/help/node_modules/@cmfcmf/docusaurus-search-local/lib/client/theme/SearchBar/generated.d.ts: Missing initializer in const declaration. (2:32)
1 | export function tokenize(input: any): any[];
> 2 | export const mylunr: typeof lunr;
| ^
3 | import * as lunr from "lunr";
4 |
at instantiate (/home/lorenzo/help/node_modules/@babel/parser/lib/index.js:653:32)
at constructor (/home/lorenzo/help/node_modules/@babel/parser/lib/index.js:947:12)
at TypeScriptParserMixin.raise (/home/lorenzo/help/node_modules/@babel/parser/lib/index.js:3261:19)
at TypeScriptParserMixin.parseVar (/home/lorenzo/help/node_modules/@babel/parser/lib/index.js:13196:16)
at TypeScriptParserMixin.parseVarStatement (/home/lorenzo/help/node_modules/@babel/parser/lib/index.js:13027:10)
at TypeScriptParserMixin.parseVarStatement (/home/lorenzo/help/node_modules/@babel/parser/lib/index.js:9355:31)
at TypeScriptParserMixin.parseStatementContent (/home/lorenzo/help/node_modules/@babel/parser/lib/index.js:12624:23)
at TypeScriptParserMixin.parseStatementContent (/home/lorenzo/help/node_modules/@babel/parser/lib/index.js:9389:18)
at TypeScriptParserMixin.parseStatementLike (/home/lorenzo/help/node_modules/@babel/parser/lib/index.js:12544:17)
at TypeScriptParserMixin.parseStatementListItem (/home/lorenzo/help/node_modules/@babel/parser/lib/index.js:12524:17)
at TypeScriptParserMixin.parseExportDeclaration (/home/lorenzo/help/node_modules/@babel/parser/lib/index.js:13767:17)
at TypeScriptParserMixin.parseExportDeclaration (/home/lorenzo/help/node_modules/@babel/parser/lib/index.js:9536:85)
at TypeScriptParserMixin.maybeParseExportDeclaration (/home/lorenzo/help/node_modules/@babel/parser/lib/index.js:13722:31)
at TypeScriptParserMixin.parseExport (/home/lorenzo/help/node_modules/@babel/parser/lib/index.js:13646:29)
at TypeScriptParserMixin.parseExport (/home/lorenzo/help/node_modules/@babel/parser/lib/index.js:9332:20)
at TypeScriptParserMixin.parseStatementContent (/home/lorenzo/help/node_modules/@babel/parser/lib/index.js:12656:27)
at TypeScriptParserMixin.parseStatementContent (/home/lorenzo/help/node_modules/@babel/parser/lib/index.js:9389:18)
at TypeScriptParserMixin.parseStatementLike (/home/lorenzo/help/node_modules/@babel/parser/lib/index.js:12544:17)
at TypeScriptParserMixin.parseModuleItem (/home/lorenzo/help/node_modules/@babel/parser/lib/index.js:12521:17)
at TypeScriptParserMixin.parseBlockOrModuleBlockBody (/home/lorenzo/help/node_modules/@babel/parser/lib/index.js:13116:36)
at TypeScriptParserMixin.parseBlockBody (/home/lorenzo/help/node_modules/@babel/parser/lib/index.js:13109:10)
at TypeScriptParserMixin.parseProgram (/home/lorenzo/help/node_modules/@babel/parser/lib/index.js:12435:10)
at TypeScriptParserMixin.parseTopLevel (/home/lorenzo/help/node_modules/@babel/parser/lib/index.js:12425:25)
at TypeScriptParserMixin.parse (/home/lorenzo/help/node_modules/@babel/parser/lib/index.js:14245:10)
at TypeScriptParserMixin.parse (/home/lorenzo/help/node_modules/@babel/parser/lib/index.js:10038:18)
at parse (/home/lorenzo/help/node_modules/@babel/parser/lib/index.js:14286:38)
at parser (/home/lorenzo/help/node_modules/@babel/core/lib/parser/index.js:41:34)
at parser.next (<anonymous>)
at parse (/home/lorenzo/help/node_modules/@babel/core/lib/parse.js:25:37)
at parse.next (<anonymous>)
at evaluateSync (/home/lorenzo/help/node_modules/gensync/index.js:251:28)
at sync (/home/lorenzo/help/node_modules/gensync/index.js:89:14)
at stopHiding - secret - don't use this - v1 (/home/lorenzo/help/node_modules/@babel/core/lib/errors/rewrite-stack-trace.js:46:12)
at parse (/home/lorenzo/help/node_modules/@babel/core/lib/parse.js:34:76)
at extractSourceCodeFileTranslations (/home/lorenzo/help/node_modules/@docusaurus/core/lib/server/translations/translationsExtractor.js:94:38)
at async Promise.all (index 321)
at async extractSiteSourceCodeTranslations (/home/lorenzo/help/node_modules/@docusaurus/core/lib/server/translations/translationsExtractor.js:75:41)
at async Command.writeTranslations (/home/lorenzo/help/node_modules/@docusaurus/core/lib/commands/writeTranslations.js:74:39)
[INFO] Docusaurus version: 2.3.1
Node version: v16.18.1
How can we best reproduce the bug?
Build works fine. Only generating translation files seems to be broken. Trying other locales (e.g. npm run write-translations -- --locale it) yields the same error.
Which version of Docusaurus and @cmfcmf/docusaurus-search-local are you using?
Please describe the bug you are seeing
After installing the plugin, command
npm run write-translations
fails with:How can we best reproduce the bug?
Build works fine. Only generating translation files seems to be broken. Trying other locales (e.g.
npm run write-translations -- --locale it
) yields the same error.Which version of Docusaurus and @cmfcmf/docusaurus-search-local are you using?
Which Node.js version are you using?
v16.18.1
Which theme are you using?
Yes, I am using @docusaurus/theme-classic
How does your plugin config look like?
plugins: [[require.resolve('@cmfcmf/docusaurus-search-local'), { language: ['en', 'it'], indexBlog: false }]],
Additional context
No response