fix(search): esm interop mark.js import

pull/2239/head
Divyansh Singh 2 years ago
parent a33d09fa4e
commit 1b0a249ad6

@ -9,7 +9,6 @@ import {
useScrollLock, useScrollLock,
useSessionStorage useSessionStorage
} from '@vueuse/core' } from '@vueuse/core'
import Mark from 'mark.js'
import MiniSearch, { type SearchResult } from 'minisearch' import MiniSearch, { type SearchResult } from 'minisearch'
import { useRouter } from 'vitepress' import { useRouter } from 'vitepress'
import { import {
@ -110,10 +109,11 @@ watch(filterText, () => {
enableNoResults.value = false enableNoResults.value = false
}) })
const mark = computed(() => { const mark = computedAsync(async () => {
if (!resultsEl.value) return if (!resultsEl.value) return
return new Mark(resultsEl.value) const mod = await import('mark.js')
}) return markRaw(new (mod.default ?? mod)(resultsEl.value))
}, null)
debouncedWatch( debouncedWatch(
() => [searchIndex.value, filterText.value, showDetailedList.value] as const, () => [searchIndex.value, filterText.value, showDetailedList.value] as const,

Loading…
Cancel
Save