Skip to content

Commit

Permalink
fix: use require.resolve for generated js, fixes #459
Browse files Browse the repository at this point in the history
  • Loading branch information
weareoutman committed Oct 8, 2024
1 parent a37e86f commit edecbe8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion docusaurus-search-local/src/server/utils/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ export function generate(config: ProcessedPluginOptions, dir: string): string {
}
if (language.includes("zh")) {
contents.push(
'require("@easyops-cn/docusaurus-search-local/dist/client/shared/lunrLanguageZh").lunrLanguageZh(lunr);'
`require(${JSON.stringify(
require.resolve(
"@easyops-cn/docusaurus-search-local/dist/client/shared/lunrLanguageZh"
)
)}).lunrLanguageZh(lunr);`
);
}
if (language.length > 1) {
Expand Down

0 comments on commit edecbe8

Please sign in to comment.