pull/5291/merge
wang5333 2 weeks ago committed by GitHub
commit 9b0a7ec52c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -222,6 +222,25 @@ export default {
}
```
If the external theme package imports VitePress or Vue files that need to be
compiled during build, add the package name to Vite's `ssr.noExternal` option.
Use the package name that appears in your theme import, not a Vue component
name. This allows Vite to bundle the theme package for SSR instead of loading
it directly from `node_modules`.
```ts [.vitepress/config.ts]
export default {
vite: {
ssr: {
noExternal: ['awesome-vitepress-theme']
}
}
}
```
This can help when `vitepress dev` works but `vitepress build` fails with an
`ERR_MODULE_NOT_FOUND` error for files imported through a distributed theme.
Finally, if the theme provides types for its theme config:
```ts [.vitepress/config.ts]

Loading…
Cancel
Save