Skip to content

Commit 1b0a249

Browse files
committed
fix(search): esm interop mark.js import
1 parent a33d09f commit 1b0a249

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/client/theme-default/components/VPLocalSearchBox.vue

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
useScrollLock,
1010
useSessionStorage
1111
} from '@vueuse/core'
12-
import Mark from 'mark.js'
1312
import MiniSearch, { type SearchResult } from 'minisearch'
1413
import { useRouter } from 'vitepress'
1514
import {
@@ -110,10 +109,11 @@ watch(filterText, () => {
110109
enableNoResults.value = false
111110
})
112111
113-
const mark = computed(() => {
112+
const mark = computedAsync(async () => {
114113
if (!resultsEl.value) return
115-
return new Mark(resultsEl.value)
116-
})
114+
const mod = await import('mark.js')
115+
return markRaw(new (mod.default ?? mod)(resultsEl.value))
116+
}, null)
117117
118118
debouncedWatch(
119119
() => [searchIndex.value, filterText.value, showDetailedList.value] as const,

0 commit comments

Comments
 (0)