docs: fix async config example (#3500)

pull/3501/head
skirtle 5 months ago committed by GitHub
parent 5811b62657
commit c68f23d31a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -31,10 +31,10 @@ If you need to dynamically generate the config, you can also default export a fu
```ts
import { defineConfig } from 'vitepress'
export default async () => defineConfig({
const posts = await (await fetch('https://my-cms.com/blog-posts')).json()
export default async () => {
const posts = await (await fetch('https://my-cms.com/blog-posts')).json()
return {
return defineConfig({
// app level config options
lang: 'en-US',
title: 'VitePress',
@ -49,8 +49,8 @@ export default async () => defineConfig({
}))
]
}
}
})
})
}
```
You can also use top-level `await`. For example:

Loading…
Cancel
Save