\n\n\u003Cimg width=\"308\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/0e1beb6b-d06b-436c-b106-c924fead87ab\" />\n\n\u003Cimg width=\"931\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/aef6f71a-fa28-4b7c-b512-e6386e18159a\" />\n\n### Describe the solution you'd like\n\nIn my [pull request](https://github.com/vuejs/vitepress/pull/4630), I've introduced custom components that can be overridden in the `enhanceApp` function. In these custom components, I can add custom logic for rendering text, such as using the Vue compile function. \n\nAdditionally, I added a flag to skip the title update, allowing for custom logic implementation. \n\nPlease also see my PR: [https://github.com/vuejs/vitepress/pull/4630](https://github.com/vuejs/vitepress/pull/4630).\n\n### Describe alternatives you've considered\n\n_No response_\n\n### Additional context\n\n_No response_\n\n### Validations\n\n- [x] Follow our [Code of Conduct](https://vuejs.org/about/coc.html)\n- [x] Read the [docs](https://vitepress.dev).\n- [x] Read the [Contributing Guidelines](https://github.com/vuejs/vitepress/blob/main/.github/contributing.md).\n- [x] Check that there isn't already an issue that asks for the same feature to avoid creating a duplicate.",[],4637,"Sidenav Components / Skip title update","2025-03-20T12:17:14Z","https://github.com/vuejs/vitepress/issues/4637",0.75188774,{"description":3081,"labels":3082,"number":3083,"owner":3027,"repository":3028,"state":3084,"title":3085,"updated_at":3086,"url":3087,"score":3088},"### Describe the bug\n\nWhen I used useData().frontmatter to make the home page, I found that when switching pages, its custom frontmatter data did not change.\r\n\r\n\r\nMaybe meet it in the future #631 \r\nMaybe my usage is wrong, please let me know. Thx~\n\n### Reproduction\n\nI made a minimal example repository:\r\nhttps://github.com/Zhengqbbb/vitepress-recurrent\r\n\r\n```\r\ngit clone https://github.com/Zhengqbbb/vitepress-recurrent.git\r\npnpm install\r\npnpm docs:dev\r\n```\r\ntry to try to press button\n\n### Expected behavior\n\nthe custom frontmatter will change when switching pages\n\n### System Info\n\n```shell\nSystem:\r\n OS: macOS 12.0.1\r\n CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz\r\n Memory: 124.98 MB / 16.00 GB\r\n Shell: 5.8 - /bin/zsh\r\n Binaries:\r\n Node: 16.15.0 - /usr/local/bin/node\r\n Yarn: 1.22.18 - /usr/local/bin/yarn\r\n npm: 8.5.5 - /usr/local/bin/npm\r\n Browsers:\r\n Chrome: 102.0.5005.61\r\n Safari: 15.1\r\n npmPackages:\r\n vitepress: 1.0.0-alpha.1 => 1.0.0-alpha.1\n```\n\n\n### Additional context\n\nhttps://user-images.githubusercontent.com/40693636/173105671-12b9c26d-78b4-4660-927e-a961a74f4e2b.mp4\n\n### Validations\n\n- [X] Follow our [Code of Conduct](https://vuejs.org/about/coc.html)\n- [X] Read the [docs](https://vitepress.vuejs.org).\n- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.",[],769,"closed","custom useData is not reactive","2023-01-21T14:34:13Z","https://github.com/vuejs/vitepress/issues/769",0.7017926,{"description":3090,"labels":3091,"number":3095,"owner":3027,"repository":3028,"state":3084,"title":3096,"updated_at":3097,"url":3098,"score":3099},"### Describe the bug\r\n\r\nWhen extending the default theme with pre-built Vue component, dev server, build stages behave differently when install the pre-built Vue component as workspace dependency and as a regular npm registry dependency.\r\n\r\nThe integrate the pre-built Vue component consists native elements with reference to one of the field `lang` returned by a composable `useData()` from `vitepress`:\r\n\r\n```vue\r\n\u003Cscript setup lang=\"ts\">\r\nimport { useData } from 'vitepress'\r\n\r\nconst { lang } = useData()\r\n\u003C/script>\r\n\r\n\u003Ctemplate>\r\n \u003Cdiv>\r\n \u003Ch1>TryUseData\u003C/h1>\r\n \u003Cp>lang: {{ lang }}\u003C/p>\r\n \u003C/div>\r\n\u003C/template>\r\n```\r\n\r\nThe bundled esm module looks like this:\r\n\r\n```js\r\nimport { defineComponent as n, openBlock as a, createElementBlock as o, createElementVNode as e, toDisplayString as r, unref as l } from \"vue\";\r\nimport { useData as s } from \"vitepress\";\r\nconst c = /* @__PURE__ */ e(\"h1\", null, \"TryUseData\", -1), f = /* @__PURE__ */ n({\r\n __name: \"TryUseData\",\r\n setup(p) {\r\n const { lang: t } = s();\r\n return (_, m) => (a(), o(\"div\", null, [\r\n c,\r\n e(\"p\", null, \"lang: \" + r(l(t)), 1)\r\n ]));\r\n }\r\n});\r\nexport {\r\n f as TryUseData\r\n};\r\n```\r\n\r\nThis pre-built component works well and expected when install the bundled package in Monorepo, but if you try to build when install it as a regular dependency, error appears:\r\n\r\n```shell\r\nnr docs:build\r\n\r\n> @ docs:build /vitepress-usedata-repro-monorepo/repros/regular-dep\r\n> vitepress build\r\n\r\n\r\n vitepress v1.0.0-rc.12\r\n\r\n✓ building client + server bundles...\r\nbuild error:\r\nfile://vitepress-usedata-repro-monorepo/repros/regular-dep/node_modules/.pnpm/vitepress-usedata-repro-monorepo-components@1.0.0_vitepress@1.0.0-rc.12_vue@3.3.4/node_modules/vitepress-usedata-repro-monorepo-components/dist/index.es.mjs:2\r\nimport { useData as s } from \"vitepress\";\r\n ^^^^^^^\r\nSyntaxError: The requested module 'vitepress' does not provide an export named 'useData'\r\n at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)\r\n at async ModuleJob.run (node:internal/modules/esm/module_job:190:5)\r\n ELIFECYCLE Command failed with exit code 1.\r\n```\r\n\r\n### What I tried\r\n\r\n#### With a locally `\u003CClientOnly>`\r\n\r\nSince the `ClientOnly` is not exported and it cannot be correctly processed in external UI libraries, I tried to use a local wrapped `\u003CClientOnly>` component with a ref boolean value `mounted` to conditional render the children components with the `v-if` render, it worked when used as regular dependency.\r\n\r\n#### With a `\u003CSuspense>` and lazy import\r\n\r\nI referenced [Importing in Mounted Hook](https://vitepress.dev/guide/ssr-compat#importing-in-mounted-hook) section of VitePress documentation, it suggests:\r\n\r\n> ```ts\r\n> onMounted(() => {\r\n> import('./lib-that-access-window-on-import').then((module) => {\r\n> // use code\r\n> })\r\n> })\r\n> ```\r\n\r\nHowever, VitePress uses `provide` and `inject` API from Vue for `useData()` and `inject()` is not possible to be called outside of `setup()` function, so I have to wrapped the `lang` into a child component with a `v-model:lang` as `v-model`, and `await import('vitepress')` to get it working.\r\n\r\n### Thoughts\r\n\r\nThough, I find my way to solve it, but **why i18n is not possible to obtain when building when VitePress is a static site?** I think there should be some bugs or behaviors behind the scene that I don't know about which causes these errors while behaves differently.\r\n\r\n### Reproduction\r\n\r\nFull reproduction requires a private npm registry to simulate the npm bahavior, therefore I created a detailed reproduction as a repository rather than a StackBlitz container: https://github.com/nekomeowww/reproduction-vitepress-usedata-error\r\n\r\n> I cannot find a better automated way to achieve this, if you have any better and easier reproduction method, please share it with me!\r\n\r\n### Expected behavior\r\n\r\n1. The 'useData' is accessible from 'vitepress' when in runtime and build time, it shouldn't produces errors.\r\n2. Workaround to obtain the i18n locale code. Shouldn't be impossible to obtain it when generating static sites.\r\n3. Workaround for pre-built Vue components.\r\n\r\n### System Info\r\n\r\n```Text\r\nSystem:\r\n OS: macOS 13.4.1\r\n CPU: (10) arm64 Apple M1 Pro\r\n Memory: 82.81 MB / 16.00 GB\r\n Shell: 5.9 - /bin/zsh\r\n Binaries:\r\n Node: 18.17.1 - ~/.volta/tools/image/node/18.17.1/bin/node\r\n Yarn: 3.6.1 - ~/.volta/tools/image/yarn/3.6.1/bin/yarn\r\n npm: 9.6.7 - ~/.volta/tools/image/node/18.17.1/bin/npm\r\n pnpm: 8.6.12 - ~/.volta/bin/pnpm\r\n Browsers:\r\n Chrome: 117.0.5938.88\r\n Chrome Canary: 119.0.6016.0\r\n Safari: 16.5.2\r\n```\r\n\r\n\r\n### Additional context\r\n\r\nI found out a statement says the vitepress is specially handled in issue #1900:\r\n\r\n> As mentioned above, The 'vitepress' dose not provide an export named 'useData'. The actual dependence is 'vitepress/dist/client/index.js'\r\n> Because the 'vitepress' is specially processed in the development environment. You will not be confused in vitepress project when debugging API Reference. But vitepress is actually a CLI role.\r\n\r\nI tried to integrate and import `vitepress/dist/client/index.js` instead of import it directly in the Vue component, however, another build error would appear when building the Vue component (yes, before install and import into a VitePress `theme/index.ts`):\r\n\r\n```shell\r\nnr build \r\n\r\n> vitepress-usedata-repro-monorepo-components@1.0.7 build /packages/vitepress-usedata-repro-monorepo-components\r\n> vite build && vue-tsc --declaration --emitDeclarationOnly\r\n\r\nvite v4.4.9 building for production...\r\n✓ 7 modules transformed.\r\n✓ built in 225ms\r\n[vite]: Rollup failed to resolve import \"@siteData\" from \"/plugins/node_modules/.pnpm/vitepress@1.0.0-rc.12_@algolia+client-search@4.19.1_@types+node@20.6.0_less@4.2.0_search-insights@2.8.2/node_modules/vitepress/dist/client/app/data.js\".\r\nThis is most likely unintended because it can break your application at runtime.\r\nIf you do want to externalize this module explicitly add it to\r\n`build.rollupOptions.external`\r\nerror during build:\r\nError: [vite]: Rollup failed to resolve import \"@siteData\" from \"/plugins/node_modules/.pnpm/vitepress@1.0.0-rc.12_@algolia+client-search@4.19.1_@types+node@20.6.0_less@4.2.0_search-insights@2.8.2/node_modules/vitepress/dist/client/app/data.js\".\r\nThis is most likely unintended because it can break your application at runtime.\r\nIf you do want to externalize this module explicitly add it to\r\n`build.rollupOptions.external`\r\n at viteWarn (file:///plugins/node_modules/.pnpm/vite@4.4.9_@types+node@20.6.0_less@4.2.0/node_modules/vite/dist/node/chunks/dep-df561101.js:48142:27)\r\n at onRollupWarning (file:///plugins/node_modules/.pnpm/vite@4.4.9_@types+node@20.6.0_less@4.2.0/node_modules/vite/dist/node/chunks/dep-df561101.js:48174:9)\r\n at onwarn (file:///plugins/node_modules/.pnpm/vite@4.4.9_@types+node@20.6.0_less@4.2.0/node_modules/vite/dist/node/chunks/dep-df561101.js:47902:13)\r\n at file:///plugins/node_modules/.pnpm/rollup@3.28.1/node_modules/rollup/dist/es/shared/node-entry.js:24194:13\r\n at Object.logger [as onLog] (file:///plugins/node_modules/.pnpm/rollup@3.28.1/node_modules/rollup/dist/es/shared/node-entry.js:25867:9)\r\n at ModuleLoader.handleInvalidResolvedId (file:///plugins/node_modules/.pnpm/rollup@3.28.1/node_modules/rollup/dist/es/shared/node-entry.js:24780:26)\r\n at file:///plugins/node_modules/.pnpm/rollup@3.28.1/node_modules/rollup/dist/es/shared/node-entry.js:24740:26\r\n ELIFECYCLE Command failed with exit code 1.\r\n```\r\n\r\nBut when I set the suggested `build.rollupOptions.external` with `vitepress/dist/client/index.js`, build passed with no error. But another failed to resolve error would appear when building for VitePress as a regular dependency:\r\n\r\n```shell\r\nbuild error:\r\nError [ERR_MODULE_NOT_FOUND]: Cannot find module '/vitepress-usedata-repro-monorepo/repros/regular-dep/node_modules/.pnpm/vitepress@1.0.0-rc.12_@algolia+client-search@4.20.0_search-insights@2.8.2/node_modules/vitepress/dist/client/app/data' imported from /vitepress-usedata-repro-monorepo/repros/regular-dep/node_modules/.pnpm/vitepress@1.0.0-rc.12_@algolia+client-search@4.20.0_search-insights@2.8.2/node_modules/vitepress/dist/client/index.js\r\n at new NodeError (node:internal/errors:405:5)\r\n at finalizeResolution (node:internal/modules/esm/resolve:324:11)\r\n at moduleResolve (node:internal/modules/esm/resolve:943:10)\r\n at defaultResolve (node:internal/modules/esm/resolve:1129:11)\r\n at nextResolve (node:internal/modules/esm/loader:163:28)\r\n at ESMLoader.resolve (node:internal/modules/esm/loader:835:30)\r\n at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)\r\n at ModuleWrap.\u003Canonymous> (node:internal/modules/esm/module_job:77:40)\r\n at link (node:internal/modules/esm/module_job:76:36)\r\n ELIFECYCLE Command failed with exit code 1.\r\n```\r\n\r\n### Validations\r\n\r\n- [X] Check if you're on the [latest VitePress version](https://github.com/vuejs/vitepress/releases/latest).\r\n- [X] Follow our [Code of Conduct](https://vuejs.org/about/coc.html)\r\n- [X] Read the [docs](https://vitepress.dev).\r\n- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.",[3092],{"name":3093,"color":3094},"bug: pending triage","e99695",2987,"inconsistent error behavior about The requested module `'vitepress'` does not provide an export named `'useData'`","2023-09-27T00:04:18Z","https://github.com/vuejs/vitepress/issues/2987",0.7341852,{"description":3101,"labels":3102,"number":3106,"owner":3027,"repository":3028,"state":3084,"title":3107,"updated_at":3108,"url":3109,"score":3110},"**Is your feature request related to a problem? Please describe.**\r\n\r\nI'm playing with the vuejs blog template, and I'm frustrated that the customData global properties is not updated on adding a new markdown file.\r\nCreating a new post required a vitepress restart. Vitepress know that a new file exist (we can load it in a new tab), but the global computed content is not updated.\r\n\r\n**Describe the solution you'd like**\r\n\r\nAdding / removing a file on the site folder (ie not the .vitepress folder) trigger an update of the global computed $site.customData (so an update of all pages using this global property).\r\n\r\n**Additional context**\r\n\r\nA basic demo project consists of the vitepress \"getting started\" project with the following modifications : \r\n\r\n- hello.md : \r\n```markdown\r\n# Hello VitePress\r\n\r\nhello\r\n\r\n{{ $site }}\r\n```\r\n\r\n- .vitepress/config.js : \r\n\r\n``` javascript\r\nconst { getPosts } = require(\"./getPosts\");\r\n\r\nmodule.exports = {\r\n title: \"Hello VitePress\",\r\n description: \"Just playing around.\",\r\n customData: {\r\n posts: getPosts(),\r\n },\r\n};\r\n```\r\n\r\n- .vitepress/getPosts.js : \r\n``` javascript\r\nconst fs = require(\"fs\");\r\nconst path = require(\"path\");\r\n\r\nexports.getPosts = function getPosts() {\r\n console.log(\"calling get posts\");\r\n const postDir = path.resolve(__dirname, \"../posts\");\r\n return fs.readdirSync(postDir);\r\n};\r\n```\r\n\r\n- a new posts folder in the vitepress project, where we are adding new markdown files.\r\n\r\n\r\n",[3103],{"name":3104,"color":3105},"invalid","ffffff",208,"Refresh global computed $site.customData when a new file is detected in the project.","2023-01-21T16:22:28Z","https://github.com/vuejs/vitepress/issues/208",0.7402097,{"description":3112,"labels":3113,"number":3115,"owner":3027,"repository":3028,"state":3084,"title":3116,"updated_at":3117,"url":3118,"score":3119},"### Describe the bug\n\nI registered a global component named `user`, and used it as `layout`, \r\nbut I didn't contain a `\u003CContent />` component because I don't intend to render markdown.\r\n\r\nthen, I write a markdown `user.md`, like this:\r\n```\r\n---\r\nlayout: user\r\n---\r\n```\r\n\r\nbut, when I navigate from another page(layout: doc) to `user.md`, the aside content isn't updated. \r\nsee:\r\nfind\n\n### Reproduction\n\nsee: [https://stackblitz.com/edit/vite-omxrm4](https://stackblitz.com/edit/vite-omxrm4?file=docs%2Findex.md)\n\n### Expected behavior\n\nWhen Navigating to another layout, the aside content can be updated in the `\u003CNav>` component, even if it doesn't contain the `\u003CContent>` component\n\n### System Info\n\n```Text\n~\n```\n\n\n### Additional context\n\n_No response_\n\n### Validations\n\n- [X] Check if you're on the [latest VitePress version](https://github.com/vuejs/vitepress/releases/latest).\n- [X] Follow our [Code of Conduct](https://vuejs.org/about/coc.html)\n- [X] Read the [docs](https://vitepress.dev).\n- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.",[3114],{"name":3093,"color":3094},3251,"In the default theme, `\u003CNav>` component doesn't update the aside content very well","2023-12-03T00:04:49Z","https://github.com/vuejs/vitepress/issues/3251",0.74372697,{"description":3121,"labels":3122,"number":3123,"owner":3027,"repository":3028,"state":3084,"title":3124,"updated_at":3125,"url":3126,"score":3127},"### Is your feature request related to a problem? Please describe.\n\nI'm using Vue components that generate headers dynamically, and (of course) the headers I create in Vue components don't appear in the outline.\n\n### Describe the solution you'd like\n\nI'd like to be able to add headers to `page.headers` in my component.\n\n### Describe alternatives you've considered\n\nI tried manipulating `page.headers` in my component from `useData()`, but the headers are read-only at that point.\n\n### Additional context\n\n_No response_\n\n### Validations\n\n- [X] Follow our [Code of Conduct](https://vuejs.org/about/coc.html)\n- [X] Read the [docs](https://vitepress.vuejs.org).\n- [X] Read the [Contributing Guidelines](https://github.com/vuejs/vitepress/blob/main/.github/contributing.md).\n- [X] Check that there isn't already an issue that asks for the same feature to avoid creating a duplicate.",[],1145,"Dynamic Outline","2023-01-21T14:26:54Z","https://github.com/vuejs/vitepress/issues/1145",0.74601203,["Reactive",3129],{},["Set"],["ShallowReactive",3132],{"$fTRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"$fumk4U0N8EsXPKEy5Tes6jiz3UgY2sKpRa8E1VnQnZ-o":-1},"/vuejs/vitepress/4878"]