Skip to content

Commit 79cf65d

Browse files
committed
fix vueform being not SSR supported
1 parent 33ed1f0 commit 79cf65d

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

.vitepress/theme/index.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import './style.css'
66
import '@vueform/vueform/dist/vueform.css';
77

88
import {enhanceAppWithTabs} from 'vitepress-plugin-tabs/client'
9-
import Vueform from '@vueform/vueform'
10-
import vueformConfig from './vueform.config'
119

1210
export default {
1311
extends: DefaultTheme,
@@ -16,8 +14,12 @@ export default {
1614
// https://vitepress.dev/guide/extending-default-theme#layout-slots
1715
})
1816
},
19-
enhanceApp({app}) {
17+
async enhanceApp({app}) {
2018
enhanceAppWithTabs(app);
21-
app.use(Vueform, vueformConfig)
19+
if (!import.meta.env.SSR) {
20+
const Vueform = await import('@vueform/vueform')
21+
const vueformConfig = await import('./vueform.config')
22+
app.use(Vueform.default, vueformConfig.default)
23+
}
2224
}
2325
} satisfies Theme

tsconfig.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@
2626
"baseUrl": ".",
2727
"paths": {
2828
"@/*": ["src/*"]
29-
}
29+
},
30+
31+
"types": ["node", "vite/client"]
3032
},
3133
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.d.ts", ".vitepress/**/*.ts", "src/**/*.vue", "src/**/*.md"],
3234
"exclude": ["node_modules", "dist", ".vitepress/cache", ".vitepress/dist"],

0 commit comments

Comments
 (0)