Skip to content

Commit

Permalink
fix(search): esm interop mark.js import
Browse files Browse the repository at this point in the history
  • Loading branch information
brc-dd committed Apr 16, 2023
1 parent a33d09f commit 1b0a249
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/client/theme-default/components/VPLocalSearchBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
useScrollLock,
useSessionStorage
} from '@vueuse/core'
import Mark from 'mark.js'
import MiniSearch, { type SearchResult } from 'minisearch'
import { useRouter } from 'vitepress'
import {
Expand Down Expand Up @@ -110,10 +109,11 @@ watch(filterText, () => {
enableNoResults.value = false
})
const mark = computed(() => {
const mark = computedAsync(async () => {
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(
() => [searchIndex.value, filterText.value, showDetailedList.value] as const,
Expand Down

0 comments on commit 1b0a249

Please sign in to comment.