\r\n\u003C/template>\r\n\r\n```\r\n\r\n- `index.md`:\r\n\r\n```md\r\n---\r\nlayout: home\r\n---\r\n\r\n\u003Cscript setup>\r\nimport { useData } from 'vitepress'\r\n\u003C/script>\r\n\r\n{{ useData() }}\r\n```\r\n\r\nSee \u003Chttps://stackblitz.com/edit/vite-x3jrgk>.\n\n### Expected behavior\n\nThere should be no such warning.\n\n### System Info\n\n```sh\nSystem:\r\n OS: macOS 13.5\r\n CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz\r\n Memory: 224.85 MB / 16.00 GB\r\n Shell: 5.9 - /bin/zsh\r\n Binaries:\r\n Node: 20.5.1 - /usr/local/bin/node\r\n npm: 9.8.0 - /usr/local/bin/npm\r\n pnpm: 8.6.6 - /usr/local/bin/pnpm\r\n Browsers:\r\n Chrome: 116.0.5845.110\r\n Edge: 115.0.1901.188\r\n Safari: 16.6\r\n npmPackages:\r\n vitepress: 1.0.0-rc.4 => 1.0.0-rc.4\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.",[2881],{"name":2882,"color":2883},"bug: pending triage","e99695",2856,"closed","Imports from vitepress in markdown files lead to reexport warning","2023-09-03T00:04:43Z","https://github.com/vuejs/vitepress/issues/2856",0.6155131,{"description":2891,"labels":2892,"number":2894,"owner":2871,"repository":2872,"state":2885,"title":2895,"updated_at":2896,"url":2897,"score":2898},"### Describe the bug\n\nAn error occurred while building with `vitepress@1.0.0-alpha.13` (`vite@3.1.0`) and `ant-design-vue` **(dev working!)**\r\n> SyntaxError: Cannot use import statement outside a module\r\n\r\n\r\n\n\n### Reproduction\n\n# Steps:\r\n1. create a new project\r\n2. register a custom component `custom-button`\r\n3. use the `custom-button` in `index.md`\r\n4. building with vitepress\r\n\r\nReproduction repo: \r\nhttps://github.com/yeojongki/vitepress-cannot-use-import-statement-outside-a-module `(cd docs && pnpm i && pnpm build)`\r\n\n\n### Expected behavior\n\nsuccess build\n\n### System Info\n\n```shell\nSystem:\r\n OS: Windows 10 10.0.19044\r\n CPU: (8) x64 Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz\r\n Memory: 12.70 GB / 31.97 GB\r\n Binaries:\r\n Node: 16.13.0 - E:\\nodejs\\node.EXE\r\n Yarn: 1.22.17 - E:\\nodejs\\yarn.CMD\r\n npm: 8.1.3 - E:\\nodejs\\npm.CMD\r\n Browsers:\r\n Edge: Spartan (44.19041.1266.0), Chromium (105.0.1343.27)\r\n Internet Explorer: 11.0.19041.1566\r\n npmPackages:\r\n vitepress: 1.0.0-alpha.13 => 1.0.0-alpha.13\n```\n\n\n### Additional context\n\nrelative issue https://github.com/vuejs/vitepress/issues/324, but closed\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.",[2893],{"name":2882,"color":2883},1329,"SyntaxError: Cannot use import statement outside a module","2023-01-21T14:25:25Z","https://github.com/vuejs/vitepress/issues/1329",0.6362947,{"description":2900,"labels":2901,"number":2903,"owner":2871,"repository":2872,"state":2885,"title":2904,"updated_at":2905,"url":2906,"score":2907},"### 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.",[2902],{"name":2882,"color":2883},4519,"\"vitepress\" work with \"unplugin-vue-components\" bug","2025-02-02T04:41:47Z","https://github.com/vuejs/vitepress/issues/4519",0.6415881,{"description":2909,"labels":2910,"number":2912,"owner":2871,"repository":2872,"state":2885,"title":2913,"updated_at":2914,"url":2915,"score":2916},"### Describe the bug\n\n```\r\n▶ yarn build:docs\r\nyarn run v1.22.10\r\n$ vitepress build docs\r\nvitepress v0.15.6\r\nvite v2.4.1\r\n✓ building client + server bundles...\r\n⠋ rendering pages...\r\n✖ rendering pages...\r\nbuild error:\r\n TypeError: Cannot read property 'imports' of undefined\r\n at resolvePageImports (x/node_modules/vitepress/dist/node/build/render.js:81:22)\r\n at Object.renderPage (x/node_modules/vitepress/dist/node/build/render.js:35:12)\r\n at async Object.build (x/node_modules/vitepress/dist/node/build/build.js:29:17)\r\nerror Command failed with exit code 1.\r\ninfo Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.\r\n```\r\n\r\nhttps://github.com/vuejs/vitepress/blob/master/src/node/build/render.ts#L115\r\n\n\n### Reproduction\n\n``` bash\r\ncd docs\r\nln -s ../CHANGELOG.md changelog.md\r\nln -s ../packages components \r\n```\n\n### Expected behavior\n\n`build` success same as `dev`\n\n### System Info\n\n```shell\nSystem:\r\n OS: macOS 11.4\r\n CPU: (8) x64 Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz\r\n Memory: 710.10 MB / 16.00 GB\r\n Shell: 5.8 - /bin/zsh\r\n Binaries:\r\n Node: 14.17.0 - /usr/local/bin/node\r\n Yarn: 1.22.10 - /usr/local/bin/yarn\r\n npm: 6.14.13 - /usr/local/bin/npm\r\n Watchman: 4.9.0 - /usr/local/bin/watchman\r\n Browsers:\r\n Chrome: 91.0.4472.164\r\n Edge: 81.0.416.77\r\n Firefox: 87.0\r\n Safari: 14.1.1\r\n Safari Technology Preview: 15.0\r\n npmPackages:\r\n vitepress: ^0.15.6 => 0.15.6\n```\n\n\n### Additional context\n\nThe following code works fine\r\n```\r\n return Array.from(new Set([\r\n ...indexChunk.imports,\r\n ...indexChunk.dynamicImports,\r\n ...(pageChunk?.imports|| []),\r\n ...(pageChunk?.dynamicImports || [])\r\n ].filter(Boolean)));\r\n```\n\n### Validations\n\n- [X] Follow our [Code of Conduct](https://vuejs.org/coc)\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.",[2911],{"name":2882,"color":2883},335,"build failed with symbolic links","2023-01-21T16:20:24Z","https://github.com/vuejs/vitepress/issues/335",0.64758384,{"description":2918,"labels":2919,"number":2923,"owner":2871,"repository":2872,"state":2885,"title":2924,"updated_at":2925,"url":2926,"score":2927},"### Describe the bug\r\n\r\nTrying to use `const articles = import.meta.glob('../*.js')` within config.js will give you an error.\r\n\r\n```\r\nfailed to load config from /**/docs/.vitepress/config.js\r\n```\r\n\r\n### Reproduction\r\n\r\nadd `const articles = import.meta.glob('../*.js')` to config.js\r\n\r\n### Expected behavior\r\n\r\nIt would be nice to be able to build a dynamic sidebar based on files you load from a directory.\r\n\r\n### System Info\r\n\r\n```shell\r\nosx, new build of vitepress as of today\r\n```\r\n\r\n\r\n### Additional context\r\n\r\nSince, `require(\"fs\");` and `require(\"path\")` dont work with vite, how else might I analyze the file system to build my sidebar?\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.vuejs.org).\r\n- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.",[2920],{"name":2921,"color":2922},"build","377ba8",572,"Make import.meta work in .vitepress/config.js","2023-01-21T14:32:52Z","https://github.com/vuejs/vitepress/issues/572",0.650232,{"description":2929,"labels":2930,"number":2932,"owner":2871,"repository":2872,"state":2885,"title":2933,"updated_at":2934,"url":2935,"score":2936},"### 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.",[2931],{"name":2882,"color":2883},922,"md file can't use import external resources","2023-01-21T14:32:45Z","https://github.com/vuejs/vitepress/issues/922",0.65313596,{"description":2938,"labels":2939,"number":2941,"owner":2871,"repository":2872,"state":2885,"title":2942,"updated_at":2943,"url":2944,"score":2945},"### Describe the bug\r\n\r\nUsing Monaco Editor (applying **[this trick](https://github.com/vuejs/vitepress/issues/1508)**) works with `npm run docs:dev` but is failing with `npm run docs:build`\r\n\r\nIn other words, Monaco Editor works in dev but fails in build. The is **not** related to imports ([ex1](https://github.com/vuejs/vitepress/issues/1508), [ex2](https://github.com/vitejs/vite/discussions/1791#discussioncomment-321046, [ex3](https://twitter.com/youyuxi/status/1355316139144970240?s=20))\r\n\r\nThe error when building reads is about module_not_found (the package is definitely installed & path exists):\r\n\r\n```\r\nError [ERR_MODULE_NOT_FOUND]: Cannot find package '/home/projects/nbwixzanm.github/node_modules/monaco-editor/' imported from /home/projects/nbwixzanm.github/.vitepress/.temp/....\r\n```\r\n\r\nStackblitz:\r\n\u003Cimg width=\"1040\" alt=\"image\" src=\"https://github.com/vuejs/vitepress/assets/1396559/1ce6110a-4d0e-4160-a1df-9148f778ebe3\">\r\n\r\n\r\n### Reproduction\r\n\r\nhttps://github.com/valgaze/vitepress-monaco#setup\r\n\r\nhttps://stackblitz.com/github/valgaze/vitepress-monaco # npm run docs:build\r\n\r\n### Expected behavior\r\n\r\nMonaco Editor should be able to build/bundle and find its folder that exists\r\n\r\n### System Info\r\n\r\n```sh\r\nSystem:\r\n OS: macOS 12.1\r\n CPU: (8) arm64 Apple M1\r\n Memory: 139.38 MB / 16.00 GB\r\n Shell: 3.2.57 - /bin/bash\r\n Binaries:\r\n Node: 18.11.0 - ~/.nvm/versions/node/v18.11.0/bin/node\r\n npm: 8.19.2 - ~/.nvm/versions/node/v18.11.0/bin/npm\r\n Browsers:\r\n Brave Browser: 114.1.52.122\r\n Chrome: 116.0.5845.96\r\n Firefox: 105.0.3\r\n Safari: 15.2\r\n npmPackages:\r\n vitepress: ^1.0.0-rc.4 => 1.0.0-rc.4\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.",[2940],{"name":2882,"color":2883},2832,"Monaco-editor + Vitepress not found on 1.0.0-rc.4 when building?","2023-08-31T00:04:23Z","https://github.com/vuejs/vitepress/issues/2832",0.6594953,{"description":2947,"labels":2948,"number":2950,"owner":2871,"repository":2872,"state":2885,"title":2951,"updated_at":2952,"url":2953,"score":2954},"### Describe the bug\r\n\r\nThere is no problem in the development environment, but an error was thrown during packaging execution\r\n\u003Cimg width=\"1320\" alt=\"image\" src=\"https://github.com/vuejs/vitepress/assets/142566415/3a33fbd2-7d53-4bee-b0d0-db8ded2b047d\">\r\n\r\n### Reproduction\r\n\r\nFor development - npm run docs:dev\r\nFor build - npm run docs:build\r\n\r\nEquivalent stackblitz links:\r\n[https://stackblitz.com/edit/vite-dkrbry](https://stackblitz.com/edit/vite-dkrbry)\r\n\r\n### Expected behavior\r\n\r\nProduction should match with development.\r\n\r\n### System Info\r\n\r\n```Text\r\nSystem:\r\n OS: Linux 5.0 undefined\r\n CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz\r\n Memory: 0 Bytes / 0 Bytes\r\n Shell: 1.0 - /bin/jsh\r\n Binaries:\r\n Node: 18.18.0 - /usr/local/bin/node\r\n Yarn: 1.22.19 - /usr/local/bin/yarn\r\n npm: 9.4.2 - /usr/local/bin/npm\r\n npmPackages:\r\n vitepress: latest => 1.0.0-rc.35\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.",[2949],{"name":2882,"color":2883},3425," XXX is not supported resolving ES modules imported from XXX","2024-01-18T00:04:43Z","https://github.com/vuejs/vitepress/issues/3425",0.6633153,{"description":2956,"labels":2957,"number":2962,"owner":2871,"repository":2872,"state":2885,"title":2963,"updated_at":2964,"url":2965,"score":2966},"Vite might be removing/deprecating it's CJS API is near future (https://github.com/vitejs/vite/discussions/13928) which will impact VitePress' CJS API as well.\r\n\r\n**Edit: Let's wait on discussion at Vite's side to conclude and we will try to follow their footsteps. But, it is recommended to use ESM APIs for anything new you might be building.**\r\n\r\n~~Most of the projects already appear to be using the import syntax. A quick [GitHub code search](https://github.com/search?q=/require%5C%28%5Cs*%5B%22'%5Dvitepress%5B%22'%5D/+NOT+is:fork&type=code) shows about 20 public projects doing `require('vitepress')`. Exploring more, over half of them appear to be on `vitepress@0.x` branch. Leaving less than 10 projects that might need minor refactoring.~~\r\n\r\n`import` syntax in `config.js` file when `\"type\": \"module\"` is not specified in nearest package.json also uses the CJS build. Might be difficult to estimate the impact. But for most of the cases where people are using import without type module or mjs/mts extension the migration should be straight forward -- either change the file extension or project level type.\r\n\r\nMigration:\r\n\r\n```ts\r\n// use .mjs/.mts file extension if can't use `\"type\": \"module\"`\r\n\r\n// change\r\nconst { defineConfig } = require('vitepress')\r\n\r\nmodule.exports = {/*...*/}\r\n\r\n// to\r\nimport { defineConfig } from 'vitepress'\r\n\r\nexport default {/*...*/}\r\n\r\n// or since it's just a type helper simply do something like this\r\n\r\n/** @type {ReturnType\u003Ctypeof import('vitepress').defineConfig>} */\r\nmodule.exports = {/*...*/}\r\n\r\n// change\r\nconst { createMarkdownRenderer } = require('vitepress')\r\n // ^ or any async API like createServer, build, resolveConfig, resolveSiteData\r\n\r\nasync fn() {\r\n const md = await createMarkdownRenderer(/*...*/)\r\n}\r\n\r\n// to\r\nasync fn() {\r\n const { createMarkdownRenderer } = await import('vitepress')\r\n const md = await createMarkdownRenderer(/*...*/)\r\n}\r\n```\r\n\r\n---\r\n\r\n~~For maintainers, we will need to use [jiti](https://github.com/unjs/jiti) for the CLI and remove CJS stuff from rollup config.~~\r\n\r\nCLI won't need any changes, it's already CJS compatible and uses ESM output. Only rollup related changes need to be done.\r\n\r\nRollout plan:\r\n\r\nLet's log a warning for now if someone `require`'s the package. We can drop the CJS API by RC.\r\n\r\n/cc @kiaking @zonemeen ",[2958,2959],{"name":2921,"color":2922},{"name":2960,"color":2961},"keep-open","96DAA7",2703,"Moving VitePress' Node API as ESM only","2023-08-08T10:21:50Z","https://github.com/vuejs/vitepress/issues/2703",0.66472834,["Reactive",2968],{},["Set"],["ShallowReactive",2971],{"$fTRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"$fVtqxyp1zM2CoZa34TbN0zlU7EU4xwijFydgnGli0lsg":-1},"/vuejs/vitepress/2805"]