\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.",[2901],{"name":2882,"color":2883},2856,"Imports from vitepress in markdown files lead to reexport warning","2023-09-03T00:04:43Z","https://github.com/vuejs/vitepress/issues/2856",0.6460871,{"description":2908,"labels":2909,"number":2911,"owner":2871,"repository":2872,"state":2873,"title":2912,"updated_at":2913,"url":2914,"score":2915},"### 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.",[2910],{"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.64719194,{"description":2917,"labels":2918,"number":2920,"owner":2871,"repository":2872,"state":2873,"title":2921,"updated_at":2922,"url":2923,"score":2924},"### 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.",[2919],{"name":2882,"color":2883},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.64869946,{"description":2926,"labels":2927,"number":2931,"owner":2871,"repository":2872,"state":2873,"title":2932,"updated_at":2933,"url":2934,"score":2935},"### Describe the bug\n\n在learn中通过 yarn add --dev vitepress 安装并配置后,在运行时报错:\r\n1、(node:20568) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time\r\n(Use `node --trace-warnings ...` to show where the warning was created)\r\n2、[ERROR] No matching export in \"node_modules/vitepress/node_modules/vue/dist/vue.runtime.esm-bundler.js\" for import \"default\"\r\n3、[ERROR] No matching export in \"node_modules/vue-demi/lib/index.mjs\" for import \"set\"\n\n### Reproduction\n\n使用的vitepress版本号为:^1.0.0-rc.39\n\n### Expected behavior\n\n运行命令:yarn docs:dev\n\n### System Info\n\n```Text\n\"lerna\": \"^5.5.0\",\r\n\"vitepress\": \"^1.0.0-rc.39\"\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.",[2928],{"name":2929,"color":2930},"need more info","bdbefc",3487,"运行项目时失败","2024-02-01T00:05:22Z","https://github.com/vuejs/vitepress/issues/3487",0.6540421,{"description":2937,"labels":2938,"number":2940,"owner":2871,"repository":2872,"state":2873,"title":2941,"updated_at":2942,"url":2943,"score":2944},"### Describe the bug\n\nFor some reason vitepress's module resolution doesn't pick up re-exported things in esm modules. This may affect more than just the dependency I'm having problems with, but in this case it's @popperjs/core aka. [floating ui](https://github.com/floating-ui/floating-ui) - when importing their constant `placements` `vitepress build` throws the following error:\r\n\r\n```\r\nvitepress v1.0.0-beta.1\r\n\r\n✓ building client + server bundles...\r\n⠋ rendering pages...(node:238582) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time\r\n(Use `node --trace-warnings ...` to show where the warning was created)\r\nfile:///xxx/.vitepress/.temp/markdown-examples.md.js:3\r\nimport { createPopper, placements } from \"@popperjs/core\";\r\n ^^^^^^^^^^\r\nSyntaxError: Named export 'placements' not found. The requested module '@popperjs/core' is a CommonJS module, which may not support all module.exports as named exports.\r\nCommonJS modules can always be imported via the default export, for example using:\r\n\r\nimport pkg from '@popperjs/core';\r\nconst { createPopper, placements } = pkg;\r\n\r\n at ModuleJob._instantiate (node:internal/modules/esm/module_job:123:21)\r\n at async ModuleJob.run (node:internal/modules/esm/module_job:189:5)\r\n at async Promise.all (index 0)\r\n at async ESMLoader.import (node:internal/modules/esm/loader:530:24)\r\n at async loadPage (file:///xxx/.vitepress/.temp/Content.2e4fdb81.js:210:18)\r\n at async Object.go (file:///xxx/.vitepress/.temp/Content.2e4fdb81.js:202:5)\r\n at async render (file:///xxx/.vitepress/.temp/app.js:4561:3)\r\n at async renderPage (file:///xxx/node_modules/vitepress/dist/node/serve-d5608de4.js:41246:19)\r\n at async Promise.all (index 3)\r\n at async build (file:///xxx/node_modules/vitepress/dist/node/serve-d5608de4.js:41781:7)\r\n✖ rendering pages...\r\nbuild error:\r\nfile:///xxx/.vitepress/.temp/markdown-examples.md.js:3\r\nimport { createPopper, placements } from \"@popperjs/core\";\r\n ^^^^^^^^^^\r\nSyntaxError: Named export 'placements' not found. The requested module '@popperjs/core' is a CommonJS module, which may not support all module.exports as named exports.\r\nCommonJS modules can always be imported via the default export, for example using:\r\n\r\nimport pkg from '@popperjs/core';\r\nconst { createPopper, placements } = pkg;\r\n\r\n at ModuleJob._instantiate (node:internal/modules/esm/module_job:123:21)\r\n at async ModuleJob.run (node:internal/modules/esm/module_job:189:5)\r\n at async Promise.all (index 0)\r\n at async ESMLoader.import (node:internal/modules/esm/loader:530:24)\r\n at async loadPage (file:///xxx/.vitepress/.temp/Content.2e4fdb81.js:210:18)\r\n at async Object.go (file:///xxx/.vitepress/.temp/Content.2e4fdb81.js:202:5)\r\n at async render (file:///xxx/.vitepress/.temp/app.js:4561:3)\r\n at async renderPage (file:///xxx/node_modules/vitepress/dist/node/serve-d5608de4.js:41246:19)\r\n at async Promise.all (index 3)\r\n at async build (file:///xxx/node_modules/vitepress/dist/node/serve-d5608de4.js:41781:7)\r\n\r\nProcess finished with exit code 1\r\n```\r\n\r\nThe dependency is not marked as \"native\" esm module (via `\"type\": \"module\"` in the `package.json`) but provides both cjs, esm and umd bundles. \r\n\r\nThe import path looks like the following: `@popperjs/core -> @popperjs/core/dist/esm/index.js -> @popperjs/core/dist/esm/enums.js `, you can check it out in the `node_modules` folder.\n\n### Reproduction\n\nReproduced [here](https://stackblitz.com/edit/vite-k6uusu?file=package.json,docs%2Fexample.md), in actuality this is a dependency of another dependency, where it wasn't possible to import it if `\"type\": \"module\"` wasn't specified in the `package.json`. So it seems like there is a problem with esm modules that support esm, but don't have `\"type\": \"module\"` set in their `package.json`.\n\n### Expected behavior\n\nIt should import the constant correctly.\n\n### System Info\n\n```sh\nSystem:\r\n OS: Linux 5.19 Ubuntu 22.04.2 LTS 22.04.2 LTS (Jammy Jellyfish)\r\n CPU: (16) x64 AMD Ryzen 7 5800H with Radeon Graphics\r\n Memory: 4.73 GB / 31.22 GB\r\n Container: Yes\r\n Shell: 5.1.16 - /bin/bash\r\n Binaries:\r\n Node: 18.12.1 - /usr/local/bin/node\r\n npm: 9.6.6 - /usr/local/bin/npm\r\n Browsers:\r\n Chrome: 113.0.5672.126\r\n npmPackages:\r\n vitepress: ^1.0.0-beta.1 => 1.0.0-beta.1\n```\n\n\n### Additional context\n\nMaybe related to #1232 and [#10822](https://github.com/nuxt/nuxt/discussions/10822)\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.",[2939],{"name":2882,"color":2883},2411,"Build fails because a requested module is a CommonJS module, even though it's not (kinda)","2023-06-02T00:04:14Z","https://github.com/vuejs/vitepress/issues/2411",0.6591093,{"description":2946,"labels":2947,"number":2949,"owner":2871,"repository":2872,"state":2873,"title":2950,"updated_at":2951,"url":2952,"score":2953},"### Describe the bug\n\n\r\n\r\n打包报错css问题,css没有任何问题,theme里全局引入组件库的,版本\"vitepress\": \"1.0.0-beta.1\"\n\n### Reproduction\n\nv \"vitepress\": \"1.0.0-beta.1\"\n\n### Expected behavior\n\n正常打包\n\n### System Info\n\n```sh\nnpm run build\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.",[2948],{"name":2882,"color":2883},2439,"打包报错Unexpected token '.' 问题","2023-06-08T00:04:08Z","https://github.com/vuejs/vitepress/issues/2439",0.6638451,{"description":2955,"labels":2956,"number":2958,"owner":2871,"repository":2872,"state":2873,"title":2959,"updated_at":2960,"url":2961,"score":2962},"\u003C!--\r\nNOTE:\r\nVitePress is still WIP, and it is not compatible with VuePress.\r\nPlease do not open issue about default theme missing features or something doesn't work like VuePress.\r\n-->\r\n\r\n**Describe the bug**\r\n\r\n```bash\r\n> vitepress build\r\n\r\nvitepress v0.7.3\r\nvite v1.0.0-rc.9\r\nbuilding client bundle...\r\nbuilding server bundle...\r\nrendering pages...\r\nbuild error:\r\n /*****/node_modules/vitepress/dist/client/app/temp/_assets/app.js:317\r\n nextProps[name] = ctx.slots[name]?.() ?? props[name];\r\n ^\r\n\r\nSyntaxError: Unexpected token '.'\r\n```\r\n\r\n**To Reproduce**\r\nSteps to reproduce the behavior:\r\n\r\n```typescript\r\nimport { computed, ComputedRef, SetupContext, VNode } from 'vue';\r\n\r\nexport function useReactLikeProps\u003CTProps extends Record\u003Cstring, any>>(\r\n component: any,\r\n props: TProps,\r\n ctx: SetupContext\u003Cany>,\r\n): ComputedRef\u003C\r\n TProps & {\r\n children?: VNode;\r\n }\r\n> {\r\n return computed(() => {\r\n const nextProps = { ...props };\r\n const VNodeProps: string[] = Object.keys(component.props).filter(name => {\r\n return (\r\n typeof component.props[name] === 'object' &&\r\n component.props[name].__TYPE__ === 'VNode'\r\n );\r\n });\r\n VNodeProps.forEach(name => {\r\n (nextProps as any)[name] = ctx.slots[name]?.() ?? props[name];\r\n });\r\n (nextProps as any).children = ctx.slots.default?.();\r\n return nextProps;\r\n });\r\n}\r\n```\r\n\r\n**Expected behavior**\r\nA clear and concise description of what you expected to happen.\r\n\r\n**System Info**\r\n- vitepress version: v0.7.3\r\n- vite version: v1.0.0-rc.9\r\n- Node version: v12.18.4\r\n- OS version: mac 10.15.7\r\n\r\n**Additional context**\r\nAdd any other context about the problem here.\r\n",[2957],{"name":2868,"color":2869},120,"build error: SyntaxError: Unexpected token '.'","2023-01-21T16:24:17Z","https://github.com/vuejs/vitepress/issues/120",0.6643408,["Reactive",2964],{},["Set"],["ShallowReactive",2967],{"$fTRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"$fvvhqVfwd4ti7aGpbjgPaZcBDBvvS4zJl02DayyZmZdY":-1},"/vuejs/vitepress/1399"]