\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.",[3087],{"name":3020,"color":3021},2856,"Imports from vitepress in markdown files lead to reexport warning","2023-09-03T00:04:43Z","https://github.com/vuejs/vitepress/issues/2856",0.6752376,{"description":3094,"labels":3095,"number":3097,"owner":3023,"repository":3024,"state":3025,"title":3098,"updated_at":3099,"url":3100,"score":3101},"### 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.",[3096],{"name":3020,"color":3021},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.68127257,{"description":3103,"labels":3104,"number":3108,"owner":3023,"repository":3024,"state":3025,"title":3035,"updated_at":3109,"url":3110,"score":3111},"### Describe the bug\n\nI try to use a library called `share-buttons-links`, and when I run the project locally everything works without any problem, when I try to make a build of the project I get this error:\r\n\r\nimport ButtonGroup from './ButtonGroup.vue';\r\n^^^^^^\r\n\r\nSyntaxError: Cannot use import statement outside a module\r\n\r\nSyntaxError: Cannot use import statement outside a module\r\n at Object.compileFunction (node:vm:360:18)\r\n at wrapSafe (node:internal/modules/cjs/loader:1078:15)\r\n at Module._compile (node:internal/modules/cjs/loader:1113:27)\r\n at Module._extensions..js (node:internal/modules/cjs/loader:1203:10)\r\n at Module.load (node:internal/modules/cjs/loader:1027:32)\r\n at Module._load (node:internal/modules/cjs/loader:868:12)\r\n at ModuleWrap.\u003Canonymous> (node:internal/modules/esm/translators:169:29)\r\n at ModuleJob.run (node:internal/modules/esm/module_job:193:25)\r\n at async Promise.all (index 0)\r\n at async ESMLoader.import (node:internal/modules/esm/loader:526:24)\r\n \r\n \r\n Before the error said I had to add `\"type\": \"module\", but the error still persist, I changed the `postcss.config.js` to `.cjs` file and `tailwind.config.js` to `.cjs`.\n\n### Reproduction\n\nHappen when I run `yarn docs:build`\n\n### Expected behavior\n\nI expect the project builds successfully and run `yarn build:serve` to test the production mode and deploy in Netlify.\n\n### System Info\n\n```shell\nSystem:\r\n OS: macOS 12.5.1\r\n CPU: (8) arm64 Apple M1\r\n Memory: 91.89 MB / 16.00 GB\r\n Shell: 5.8.1 - /bin/zsh\r\n Binaries:\r\n Node: 18.10.0 - /opt/homebrew/bin/node\r\n Yarn: 1.22.19 - ~/.yarn/bin/yarn\r\n npm: 8.19.2 - /opt/homebrew/bin/npm\r\n Browsers:\r\n Chrome: 105.0.5195.125\r\n Firefox: 103.0.2\r\n Safari: 15.6.1\r\n npmPackages:\r\n vitepress: ^1.0.0-alpha.19 => 1.0.0-alpha.19\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.",[3105],{"name":3106,"color":3107},"question","5D5FAE",1459,"2023-01-21T14:22:50Z","https://github.com/vuejs/vitepress/issues/1459",0.68190855,["Reactive",3113],{},["Set"],["ShallowReactive",3116],{"$fTRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"$fWJBhmF4fB5qABADubkRG3qLuVAtVfPnsKLAicDHVTxQ":-1},"/vuejs/vitepress/1508"]