\r\n```\r\n\r\nAlternatively, use the `desc` defined in the `container` to write Markdown syntax.\r\n\r\n```md\r\n::: demo src=\"../demo.vue\" title=\"Demo block\"\r\n\r\nThis is a `description` that can be written using Markdown.\r\n\r\n:::\r\n```\r\n\r\n### Describe the solution you'd like\r\n\r\nTo address this, I have created the [markdown-it-vitepress-demo](https://github.com/hairyf/markdown-it-vitepress-demo) plugin. I'm not sure if it can be helpful.\r\n\r\n### Describe alternatives you've considered\r\n\r\n_No response_\r\n\r\n### Additional context\r\n\r\n- https://github.com/vuejs/vitepress/issues/987\r\n- https://github.com/vuejs/vitepress/issues/1349\r\n\r\n### Validations\r\n\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] Read the [Contributing Guidelines](https://github.com/vuejs/vitepress/blob/main/.github/contributing.md).\r\n- [X] Check that there isn't already an issue that asks for the same feature to avoid creating a duplicate.",[2865],{"name":2866,"color":2867},"stale","ededed",2432,"vuejs","vitepress","open","feat(demo): built-in markdown plugin provides support for showcasing demo capabilities.","2024-07-17T14:37:26Z","https://github.com/vuejs/vitepress/issues/2432",0.7129121,{"description":2877,"labels":2878,"number":2882,"owner":2869,"repository":2870,"state":2883,"title":2884,"updated_at":2885,"url":2886,"score":2887},"### Describe the bug\n\ndocs:build fails element-plus, when used with unplugin-vue-components and ssr: false\r\n\r\n```\r\n Components({\r\n dirs: ['components'],\r\n include: [/\\.vue$/, /\\.md$/],\r\n resolvers: [ElementPlusResolver({ ssr: false })]\r\n })\r\n\r\n```\r\n\r\nWhile changing to ssr:true gets the build to succeed, with this CSS isn't loaded. \n\n### Reproduction\n\n1. Close the repo https://github.com/akil-rails/vitepress-with-element-plus\r\n2. pnpm docs:build\r\n\r\nBuild fails with the following error: \r\n\r\n```\r\n> vitepress build docs\r\n\r\nvitepress v1.0.0-alpha.4\r\n⠸ building client + server bundles...warnings when minifying css:\r\n▲ [WARNING] \"@charset\" must be the first rule in the file\r\n\r\n \u003Cstdin>:3820:0:\r\n 3820 │ @charset \"UTF-8\";:root{--el-color-white:#ffffff;--el-color-black...\r\n ╵ ~~~~~~~~\r\n\r\n This rule cannot come before a \"@charset\" rule\r\n\r\n \u003Cstdin>:1:0:\r\n 1 │ @font-face {\r\n ╵ ^\r\n\r\n\r\n✓ building client + server bundles...\r\n⠋ rendering pages...Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/akhileshkataria/Code/spikes/vitepress-with-element-plus/node_modules/.pnpm/element-plus@2.2.13_vue@3.2.37/node_modules/element-plus/es/index.mjs not supported.\r\nInstead change the require of /Users/akhileshkataria/Code/spikes/vitepress-with-element-plus/node_modules/.pnpm/element-plus@2.2.13_vue@3.2.37/node_modules/element-plus/es/index.mjs to a dynamic import() which is available in all CommonJS modules.\r\n at Module.\u003Canonymous> (/Users/akhileshkataria/Code/spikes/vitepress-with-element-plus/docs/.vitepress/.temp/index.md.js:3:10)\r\n at /Users/akhileshkataria/Code/spikes/vitepress-with-element-plus/docs/.vitepress/.temp/app.js:4045:50\r\n at async loadPage (/Users/akhileshkataria/Code/spikes/vitepress-with-element-plus/docs/.vitepress/.temp/app.js:216:16) {\r\n code: 'ERR_REQUIRE_ESM'\r\n}\r\n✖ rendering pages...\r\nbuild error:\r\n Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/akhileshkataria/Code/spikes/vitepress-with-element-plus/node_modules/.pnpm/element-plus@2.2.13_vue@3.2.37/node_modules/element-plus/es/index.mjs not supported.\r\nInstead change the require of /Users/akhileshkataria/Code/spikes/vitepress-with-element-plus/node_modules/.pnpm/element-plus@2.2.13_vue@3.2.37/node_modules/element-plus/es/index.mjs to a dynamic import() which is available in all CommonJS modules.\r\n at Module.\u003Canonymous> (/Users/akhileshkataria/Code/spikes/vitepress-with-element-plus/docs/.vitepress/.temp/index.md.js:3:10)\r\n at async Promise.all (index 0)\r\n at async renderPage (file:///Users/akhileshkataria/Code/spikes/vitepress-with-element-plus/node_modules/.pnpm/vitepress@1.0.0-alpha.4/node_modules/vitepress/dist/node/serve-05342c3d.js:39555:28)\r\n at async build (file:///Users/akhileshkataria/Code/spikes/vitepress-with-element-plus/node_modules/.pnpm/vitepress@1.0.0-alpha.4/node_modules/vitepress/dist/node/serve-05342c3d.js:39853:9) {\r\n code: 'ERR_REQUIRE_ESM'\r\n\r\n```\r\n\r\n\n\n### Expected behavior\n\nThe build should succeed.\n\n### System Info\n\n```shell\nSystem:\r\n OS: macOS 11.6.7\r\n CPU: (8) x64 Intel(R) Core(TM) i7-4960HQ CPU @ 2.60GHz\r\n Memory: 510.54 MB / 16.00 GB\r\n Shell: 3.2.57 - /bin/bash\r\n Binaries:\r\n Node: 16.15.1 - /usr/local/bin/node\r\n Yarn: 1.22.19 - /usr/local/bin/yarn\r\n npm: 8.11.0 - /usr/local/bin/npm\r\n Browsers:\r\n Chrome: 103.0.5060.53\r\n Safari: 15.5\r\n npmPackages:\r\n vitepress: 1.0.0-alpha.4 => 1.0.0-alpha.4\n```\n\n\n### Additional context\n\nelement-plus has been discussed earlier: https://github.com/vuejs/vitepress/issues/603\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.",[2879],{"name":2880,"color":2881},"build","377ba8",1164,"closed","Unable to use element-plus with vitepress: works in dev mode, but fails to build","2023-01-21T14:25:26Z","https://github.com/vuejs/vitepress/issues/1164",0.70114654,{"description":2889,"labels":2890,"number":2891,"owner":2869,"repository":2870,"state":2883,"title":2892,"updated_at":2893,"url":2894,"score":2895},"\r\n**Describe the bug**\r\nvitepress dev docs working but vitepress build docs has errors.\r\n\r\n```\r\n> vitepress dev docs\r\n\r\nvitepress v0.15.3\r\nvite v2.3.7\r\nD:\\vue3-openlayers\\docs\\.vitepress\\config.js\r\n\r\n vite v2.3.7 dev server running at:\r\n\r\n > Local: http://localhost:3000/\r\n > Network: use `--host` to expose\r\n[@vue/compiler-sfc] \u003Cscript setup> is still an experimental proposal.\r\nFollow its status at https://github.com/vuejs/rfcs/pull/227.\r\n\r\n[@vue/compiler-sfc] When using experimental features,\r\nit is recommended to pin your vue dependencies to exact versions to avoid breakage.\r\n```\r\n\r\n```\r\n> vitepress build docs\r\n\r\nvitepress v0.15.3\r\nvite v2.3.7\r\n⠧ building client + server bundles...\r\n(!) Some chunks are larger than 500kb after minification. Consider:\r\n- Using dynamic import() to code-split the application\r\n- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/guide/en/#outputmanualchunks\r\n- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.\r\n✓ building client + server bundles...\r\n✖ rendering pages...\r\nbuild error:\r\n D:\\vue3-openlayers\\node_modules\\ol\\Map.js:17\r\nimport CompositeMapRenderer from './renderer/Composite.js';\r\n^^^^^^\r\n\r\nSyntaxError: Cannot use import statement outside a module\r\n at wrapSafe (internal/modules/cjs/loader.js:1001:16)\r\n at Module._compile (internal/modules/cjs/loader.js:1049:27)\r\n at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)\r\n at Module.load (internal/modules/cjs/loader.js:950:32)\r\n at Function.Module._load (internal/modules/cjs/loader.js:791:14)\r\n at Module.require (internal/modules/cjs/loader.js:974:19)\r\n at require (internal/modules/cjs/helpers.js:88:18)\r\n at Module.\u003Canonymous> (D:\\vue3-openlayers\\node_modules\\vitepress\\dist\\client\\app\\temp\\app.js:25:13)\r\n at Module._compile (internal/modules/cjs/loader.js:1085:30)\r\n at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)\r\nnpm ERR! code ELIFECYCLE\r\nnpm ERR! errno 1\r\nnpm ERR! vue3-openlayers@0.1.0 docs:build: `vitepress build docs`\r\nnpm ERR! Exit status 1\r\n```\r\n\r\n**Expected behavior**\r\n\r\nsuccess build\r\n\r\n**System Info**\r\n- vitepress version: ^0.15.3\r\n- vite version: 2.3.7\r\n- Node version: v14.13.0\r\n- OS version: win 10\r\n\r\n",[],324,"dev works but build not (Cannot use import statement outside a module)","2023-01-21T14:28:40Z","https://github.com/vuejs/vitepress/issues/324",0.70273757,{"description":2897,"labels":2898,"number":2902,"owner":2869,"repository":2870,"state":2883,"title":2903,"updated_at":2904,"url":2905,"score":2906},"### Describe the bug\n\n项目中使用了 highlightjs 作为代码预览高亮工具。开发时并未发现异常,但是在构建时提示错误\r\n```text\r\nbuild error:\r\n file:///C:/demo-code/vitepress-error/docs/.vitepress/.temp/app.js:7\r\nimport hljsVuePlugin from \"@highlightjs/vue-plugin\";\r\n ^^^^^^^^^^^^^\r\nSyntaxError: The requested module '@highlightjs/vue-plugin' does not provide an export named 'default'\r\n at ModuleJob._instantiate (node:internal/modules/esm/module_job:128:21)\r\n at async ModuleJob.run (node:internal/modules/esm/module_job:194:5)\r\n at async Promise.all (index 0)\r\n at async ESMLoader.import (node:internal/modules/esm/loader:385:24)\r\n at async build (file:///C:/demo-code/vitepress-error/node_modules/.pnpm/vitepress@1.0.0-alpha.45/node_modules/vitepress/dist/node/serve-ebe7f464.js:42286:24)\r\n ELIFECYCLE Command failed with exit code 1.\r\n```\r\n一开始我怀疑是该库存在问题,但是在常规 vue 应用中使用并构建都是没问题的。\n\n### Reproduction\n\n最小复现\r\n```text\r\nhttps://github.com/SaberA1ter/vitepress-error-demo\r\n```\r\n组件在 ```docs/.vitepress/theme/index.js``` 中注册,报错也是发生于此\n\n### Expected behavior\n\n开发正常,但是构建报错。\n\n### System Info\n\n```shell\nwin11\r\n\r\nnodejs: v16.15.1\n```\n\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] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.",[2899],{"name":2900,"color":2901},"bug: pending triage","e99695",1905,"build 报错: SyntaxError: The requested module '@highlightjs/vue-plugin' does not provide an export named 'default'","2023-02-17T00:04:39Z","https://github.com/vuejs/vitepress/issues/1905",0.70298755,{"description":2908,"labels":2909,"number":2913,"owner":2869,"repository":2870,"state":2883,"title":2914,"updated_at":2915,"url":2916,"score":2917},"### Discussed in https://github.com/vuejs/vitepress/discussions/527\r\n\r\n\u003Cdiv type='discussions-op-text'>\r\n\r\n\u003Csup>Originally posted by **WebMechanic** February 11, 2022\u003C/sup>\r\nHello,\r\n\r\nI have a fresh install of VitePress to document our new Style Guide and wanted to use the [Import Code Snippets](https://vitepress.vuejs.org/guide/markdown.html#import-code-snippets) feature for .js, .css and .html fragments, but the file(s) are not included. I tried all sorts of pathnames with/without the `base`, relative, absolute, all to no avail.\r\nEverything else works like a charme.\r\n\r\nThe project is a simple Vite Vue project. I then installed VitePress with yarn. \r\nIt resides in `src/_docs/.vitepress`.\r\n\r\nHere's the config file\r\n```js\r\nimport {defineConfig} from 'vitepress'\r\nexport default defineConfig({\r\n base: '/src/_docs/',\r\n title: \"The Style Guide\",\r\n markdown: {\r\n lineNumbers: false,\r\n toc: {includeLevel: [1, 2]},\r\n }\r\n}\r\n```\r\n\u003C/div>\r\n\r\nIt's not clear to me, if this requires some special care for Prism. Configuration seems very different fro what I can find on Lea Verou's site.\r\n",[2910],{"name":2911,"color":2912},"invalid","ffffff",530,"\"Import Code Snippets\" not working","2023-01-21T16:04:03Z","https://github.com/vuejs/vitepress/issues/530",0.7061818,{"description":2919,"labels":2920,"number":2927,"owner":2869,"repository":2870,"state":2883,"title":2928,"updated_at":2929,"url":2930,"score":2931},"### Describe the bug\r\n\r\nSyntaxError: The requested module '/component/util/allsuperclassframes.data.js?t=1697876520202' does not provide an export named 'allSuperclassFrames' (at application_provider.md:11:10)`\r\n\r\n**Data Loader** \r\n\r\n```js\r\nexport default {\r\n watch: ['../../**/class/*.json'],\r\n async load(watchedFiles) {\r\n // watchedFiles will be an array of absolute paths of the matched files.\r\n // generate an array of blog post metadata that can be used to render\r\n // a list in the theme layout\r\n console.log('watchedFiles.length :::: ', watchedFiles.length)\r\n let allSuperclassFrames/*:FrameDbDataModel[]*/ = []\r\n let superclasses = watchedFiles.map((file) => {\r\n return JSON.parse(fs.readFileSync(file, 'utf-8')).filter\r\n })\r\n superclasses.forEach(s => {\r\n if(! allSuperclassFrames.find(r => r.frame === s.frame && r.short_value === s.short_value)){\r\n allSuperclassFrames.push(s)\r\n }\r\n })\r\n console.log('result.length :::: ', allSuperclassFrames.length)\r\n return {allSuperclassFrames}\r\n }\r\n}\r\n```\r\n\r\n**Import data loader**\r\n\r\n```vue\r\n\u003Cscript setup>\r\nimport { allSuperclassFrames } from '../../../component/util/allSuperclassFrames.data'\r\n...\r\n```\r\n\r\n**package.json**\r\n\r\n```json\r\n...\r\n\"type\": \"module\",\r\n...\r\n```\r\n\r\n### Reproduction\r\n\r\nts or js data loader for local files.\r\n\r\n**Related ?**\r\n\r\nhttps://github.com/vuejs/vitepress/pull/3058\r\n\r\nhttps://github.com/vuejs/vitepress/issues/3051\r\n\r\n### Expected behavior\r\n\r\nLoad data as documented \r\n\r\nhttps://vitepress.dev/guide/data-loading#basic-usage\r\n\r\n### System Info\r\n\r\n```\r\nSystem:\r\n OS: Windows 10 10.0.22000\r\n CPU: (8) x64 Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz\r\n Memory: 5.61 GB / 15.88 GB\r\n Binaries:\r\n Node: 18.15.0 - D:\\Tools\\Nodejs\\18.15.0\\node.EXE\r\n npm: 9.8.1 - D:\\Tools\\Nodejs\\18.15.0\\npm.CMD\r\n pnpm: 8.6.3 - D:\\Tools\\Nodejs\\18.15.0\\pnpm.CMD\r\n Browsers:\r\n Edge: Spartan (44.22000.120.0), Chromium (118.0.2088.57)\r\n Internet Explorer: 11.0.22000.120\r\n npmPackages:\r\n vitepress: v1.0.0-rc.22 => 1.0.0-rc.22\r\n```\r\n\r\n### Additional context\r\n\r\n_No response_\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.",[2921,2924],{"name":2922,"color":2923},"docs","0075ca",{"name":2925,"color":2926},"contribution welcome","11E4B8",3113,"Data Loader Error : ... does not provide an export named ...","2023-10-30T00:04:38Z","https://github.com/vuejs/vitepress/issues/3113",0.7075915,{"description":2933,"labels":2934,"number":2936,"owner":2869,"repository":2870,"state":2883,"title":2937,"updated_at":2938,"url":2939,"score":2940},"### Describe the bug\n\nmd file can't use import @vicons/antd\r\n\r\n**My Code**\r\n:::demo\r\n```vue\r\n\u003Ctemplate>\r\n \u003Cwp-icon name=\"DeleteOutlined\">\u003C/wp-icon>\r\n\u003C/template>\r\n\r\n\u003Cscript lang=\"ts\" setup>\r\nimport {RightOutlined} from '@vicons/antd';\r\n\u003C/script>\r\n```\r\n:::\r\n\r\n\r\n\r\n**Browser Error**\r\n\r\n\n\n### Reproduction\n\nmd file use import\n\n### Expected behavior\n\nmd file can use import node_modules package\n\n### System Info\n\n```shell\n\"vitepress\": \"1.0.0-alpha.4\"\r\n\"@vicons/antd\": \"^0.11.0\"\r\n\"vite\": \"^2.9.0\"\n```\n\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] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.",[2935],{"name":2900,"color":2901},922,"md file can't use import external resources","2023-01-21T14:32:45Z","https://github.com/vuejs/vitepress/issues/922",0.71014994,{"description":2942,"labels":2943,"number":2945,"owner":2869,"repository":2870,"state":2883,"title":2946,"updated_at":2947,"url":2948,"score":2949},"### Describe the bug\n\nall auto import components in dev mode is ok.\nall auto import components in build mode is ok, when there have no 'script' tag in md files\n\nif md file have 'script' tag of one page. the page's auto import component will not resolve in **build mode**!!!!\n\n### Reproduction\n\nit's an empty vitepress project.\n\n[Reproduction URL](https://github.com/huchaomin/vitepress-auto-import-bug)\n\n### Expected behavior\n\n\u003Cimg width=\"900\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/76a803ce-949b-4ae2-b229-32484d930cde\" />\n\n\u003Cimg width=\"821\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/d4b60aea-4b7c-422f-8c0e-339be12dbe42\" />\n\n\u003Cimg width=\"901\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/691bb9b3-a61d-4f15-8426-68416f7340da\" />\n\n\u003Cimg width=\"915\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/9c8470cc-7c45-476a-aaf1-3f990a1c57f0\" />\n\n### System Info\n\n```Text\nSystem:\n OS: Windows 11 10.0.22631\n CPU: (28) x64 Intel(R) Core(TM) i7-14700KF\n Memory: 15.99 GB / 31.82 GB\n Binaries:\n Node: 20.17.0 - D:\\Program Files\\nodejs\\node.EXE\n npm: 10.8.2 - D:\\Program Files\\nodejs\\npm.CMD\n pnpm: 9.8.0 - D:\\Program Files\\nodejs\\pnpm.CMD\n Browsers:\n Edge: Chromium (127.0.2651.74)\n Internet Explorer: 11.0.22621.3527\n npmPackages:\n vitepress: ^1.6.3 => 1.6.3\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.",[2944],{"name":2900,"color":2901},4519,"\"vitepress\" work with \"unplugin-vue-components\" bug","2025-02-02T04:41:47Z","https://github.com/vuejs/vitepress/issues/4519",0.7114482,{"description":2951,"labels":2952,"number":2954,"owner":2869,"repository":2870,"state":2883,"title":2955,"updated_at":2956,"url":2957,"score":2958},"### 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.",[2953],{"name":2900,"color":2901},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.7120259,{"description":2960,"labels":2961,"number":2965,"owner":2869,"repository":2870,"state":2883,"title":2966,"updated_at":2967,"url":2968,"score":2969},"### Describe the bug\r\n执行pnpm run docs:build\r\n打包的时候报错!\r\n\r\n\r\n\r\n### Reproduction\r\n\r\n当进行打包的时候会出现\r\nnode版本:18.18.0\r\npnpm版本:8.7.6\r\nwindows系统\r\n\r\n### Expected behavior\r\n\r\n可以正常打包不报错\r\n\r\n### System Info\r\n\r\n```Text\r\nCannot find package 'vue' imported from C:\\Users\\changbb\\node_modules\\vue-demi\\lib\\index.mjs\r\n```\r\n\r\n\r\n### Additional context\r\n\r\n_No response_\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.",[2962],{"name":2963,"color":2964},"need more info","bdbefc",2998,"Cannot find package 'vue' ","2023-09-29T00:04:11Z","https://github.com/vuejs/vitepress/issues/2998",0.7137442,["Reactive",2971],{},["Set"],["ShallowReactive",2974],{"$fTRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"$fJS89bI5IybD3vWPNLzaM0lQHGhtWnwlNyUeOAwOzQBI":-1},"/vuejs/vitepress/1042"]