Skip to content

Commit 1a99284

Browse files
committed
fix: $slidev unwrapping on build
1 parent 35a5a32 commit 1a99284

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

packages/client/modules/context.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { App, reactive } from 'vue'
22
import type { UnwrapNestedRefs } from '@vue/reactivity'
3+
import { objectKeys } from '@antfu/utils'
34
import * as nav from '../logic/nav'
45

56
declare module '@vue/runtime-core' {
@@ -11,9 +12,16 @@ declare module '@vue/runtime-core' {
1112
export default function createSlidevContext() {
1213
return {
1314
install(app: App) {
14-
app.config.globalProperties.$slidev = {
15-
nav: reactive({ ...nav }),
15+
const navObj: typeof nav = {} as any
16+
// need to copy over to get rid of the "Module" object type (will not unwrap)
17+
for (const key of objectKeys(nav)) {
18+
if (typeof key === 'string')
19+
// @ts-expect-error
20+
navObj[key] = nav[key]
1621
}
22+
app.config.globalProperties.$slidev = reactive({
23+
nav: navObj,
24+
})
1725
},
1826
}
1927
}

0 commit comments

Comments
 (0)