Skip to content

异步获取配置不生效 #4948

@xuebear

Description

@xuebear

Describe the bug

文件:config.mts

Image 我给箭头位置打印日志 没有输出 Image

Reproduction

import { defineConfig } from 'vitepress'

export default async () => {
console.log('开始请求数据...')
const posts = await (await fetch('http://127.0.0.1:9001/dagent/vite/userInfo')).json()
console.log(posts)

return defineConfig({
// 应用级配置选项
lang: 'en-US',
title: 'VitePress',
description: 'Vite & Vue powered static site generator.',

// 主题级配置选项
themeConfig: {
  sidebar: [
    // ...posts.map((post) => ({
    //   text: post,
    // }))
  ]
}

})
}

Expected behavior

System Info

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions