Skip to content

Commit e2dec26

Browse files
committed
fix(plugin-slimsearch): prevent issue when locale is not defined
1 parent c291261 commit e2dec26

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

plugins/search/plugin-slimsearch/src/node/generateIndex.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,8 @@ export const getSearchIndexStore = async (
203203

204204
await Promise.all(
205205
entries(indexesByLocale).map(async ([localePath, indexes]) => {
206-
const lang = app.options.locales[localePath].lang ?? 'en'
206+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
207+
const lang = app.options.locales[localePath]?.lang ?? app.options.lang
207208
const tokenizer = new Intl.Segmenter(lang, { granularity: 'word' })
208209

209210
const index = createIndex<string, IndexItem, IndexItem>({

0 commit comments

Comments
 (0)