\r\n\r\nIt is inevitable to use `document` in `vitepress` many times, but how to avoid the packaging error when` vitepress` uses the server-side rendering method?\r\n\r\nAre there any third-party plug-in recommendations or configuration items?\n\n### Reproduction\n\n```vue\r\n\u003Cscript setup>\r\n console.log(document)\r\n\u003C/script>\r\n```\r\n\r\n\r\n\n\n### Expected behavior\n\nBuild ok\n\n### System Info\n\n```shell\n\"vitepress\": \"^1.0.0-alpha.4\",\r\n\"vue\": \"^3.2.33\"\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.",[2901],{"name":2902,"color":2903},"question","5D5FAE",1120,"document is not defined","2023-01-21T14:28:51Z","https://github.com/vuejs/vitepress/issues/1120",0.65952826,{"description":2910,"labels":2911,"number":2915,"owner":2871,"repository":2872,"state":2873,"title":2916,"updated_at":2917,"url":2918,"score":2919},"### Describe the bug\r\n\r\nI locate the problematic line by commenting. When `{{ }}` appears, Vitepress parses the code block in the `` line incorrectly.\r\nFor example:\r\n```jsx\r\n\u003Cdiv style={{ opacity: 1}}/>\r\n```\r\n\r\n### Reproduction\r\n\r\nnull\r\n\r\n### Expected behavior\r\n\r\nSupport to use `{{}}` in `` inline code blocks.\r\n\r\n### System Info\r\n\r\n```shell\r\nnull\r\n```\r\n\r\n\r\n### Additional context\r\n\r\n\r\n\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.",[2912],{"name":2913,"color":2914},"invalid","ffffff",1988,"Build Error: Not Support {{}} in ``","2023-03-04T00:04:19Z","https://github.com/vuejs/vitepress/issues/1988",0.66962045,{"description":2921,"labels":2922,"number":2923,"owner":2871,"repository":2872,"state":2873,"title":2924,"updated_at":2925,"url":2926,"score":2927},"### Is your feature request related to a problem? Please describe.\r\n\r\nIn order to create good documentation of a standalone Vue component, we want to show many usage examples.\r\n\r\nEvery usage example is a Vue file.\r\n\r\nWe need to be able to import a Vue file in Vitepress, show its source code as CodeBlock.\r\n- Not just a single code block like you can already do in Vitepress, but a Codeblock with tabs on top that split up the source code in `template` / `script` / `style` tabs.\r\n- Also, another tab should say `example` rendering the actual imported Vue component.\r\n\r\n\r\n### Describe the solution you'd like\r\n\r\nThe ideal syntax would look something like this:\r\n```html\r\n\u003CCodeBlockComponent filename=\"blitz-form/Basics - Basic Example\" />\r\n```\r\nAnd here is a video of how it would render in Vitepress:\r\n\r\nhttps://user-images.githubusercontent.com/3253920/140631280-adae2d0b-47d9-4172-b105-f6f4ee5f41f4.mp4\r\n\r\n(I have styled this a little bit to fit my docs style, but of course the styling can be way more bare-bones and we can overwrite the styling with CSS.)\r\n\r\n\r\n\r\n### Describe alternatives you've considered\r\n\r\nI actually already finished this feature for VitePress. I created my custom solution.\r\n\r\nUnder the hood I'm using a combination of these import methods:\r\n```js\r\nimport(`../docs/${filename}.vue`) // for the component\r\n// and\r\nimport(`../docs/${filename}.vue?raw`) // for the source code\r\n```\r\n\r\n~~Everything works when I'm using the VitePress development server. However, as soon as I build and deploy my code to a hosting service, all the Code Blocks break.~~\r\n\r\n~~I searched a lot for solutions, but this is not my strongest point. This past week I tried a bunch of things but still haven't found out how to make it work.~~\r\n\r\n(See next comment, where I explain how I fixed it)\r\n\r\n### Additional context\r\n\r\nI would love to request for an official solution for what I'm trying to do.\r\n\r\nI believe a lot of developers who want to share a Vue component and whip up a quick VitePress documentation about their component, would love this feature.\r\n\r\n### Validations\r\n\r\n- [X] Follow our [Code of Conduct](https://vuejs.org/coc)\r\n- [X] Read the [docs](https://vitepress.vuejs.org/).\r\n- [X] Read the [Contributing Guidelines](https://github.com/vuejs/vitepress/blob/master/.github/contributing.md).\r\n- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.",[],437,"FR: Code Block that renders Vue file component and source code","2023-01-29T00:04:23Z","https://github.com/vuejs/vitepress/issues/437",0.67026085,{"description":2929,"labels":2930,"number":2932,"owner":2871,"repository":2872,"state":2873,"title":2933,"updated_at":2934,"url":2935,"score":2936},"### Describe the bug\r\n\r\nwhen I update the version to `\"vitepress\": \"^1.0.0-alpha.63\",` , and run `vitepress dev docs`, The Aside component is render nothing\r\n\r\n\r\n\r\n### Reproduction\r\n\r\nupdate the vitepress version to `\"vitepress\": \"^1.0.0-alpha.63\",`\r\n\r\nrun `vitepress dev docs`\r\n\r\n`config.js`\r\n```\r\nimport { defineConfigWithTheme } from 'vitepress';\r\nimport vueJsx from '@vitejs/plugin-vue-jsx';\r\nimport baseConfig from '@vue/theme/config';\r\nimport { demoBlockPlugin } from 'vitepress-theme-demoblock';\r\nimport path from 'path';\r\n\r\nimport { i18n, nav, sidebar } from './themeConfig/index';\r\n\r\nexport default defineConfigWithTheme({\r\n extends: baseConfig,\r\n lang: 'zh-CN',\r\n title: 'SinoGear Vue',\r\n description: '',\r\n srcDir: './src',\r\n scrollOffset: 'header',\r\n ignoreDeadLinks: true,\r\n head: [['meta', { name: 'theme-color', content: '#3c8772' }]],\r\n themeConfig: {\r\n nav,\r\n sidebar,\r\n appearance: false, // 开启 light/dark 模式\r\n // Placeholder of the i18n config for @vuejs-translations.\r\n i18n,\r\n },\r\n\r\n markdown: {\r\n config(md) {\r\n md.use(demoBlockPlugin, {\r\n cssPreprocessor: 'less',\r\n scriptImports: [\r\n \"import * as AntDesignVue from 'ant-design-vue'\",\r\n ],\r\n scriptReplaces: [\r\n {\r\n searchValue: /import ({.*}) from 'ant-design-vue'/g,\r\n replaceValue: (s, s1) => `const ${s1} = AntDesignVue`\r\n },\r\n ]\r\n });\r\n }\r\n },\r\n\r\n vite: {\r\n server: {\r\n host: true,\r\n port: 3001,\r\n fs: {\r\n // for when developing with locally linked theme\r\n allow: ['../..']\r\n }\r\n },\r\n build: {\r\n chunkSizeWarningLimit: Infinity\r\n },\r\n json: {\r\n stringify: true\r\n },\r\n ssr: {\r\n noExternal: ['@wangeditor/editor', '@wangeditor/editor-for-vue', 'ant-design-vue', '@ant-design/icons-vue', '@babel/runtime']\r\n },\r\n plugins: [vueJsx()],\r\n css: {\r\n preprocessorOptions: {\r\n less: {\r\n javascriptEnabled: true\r\n }\r\n }\r\n }\r\n },\r\n\r\n vue: {\r\n reactivityTransform: path.resolve(__dirname, 'src')\r\n }\r\n});\r\n\r\n```\r\n\r\n### Expected behavior\r\n\r\nrender aside component\r\n\r\n### System Info\r\n\r\n\r\n`packages.json`\r\n```shell\r\n\r\n\"@babel/plugin-syntax-jsx\": \"^7.18.6\",\r\n \"@vitejs/plugin-vue\": \"^4.0.0\",\r\n \"@vitejs/plugin-vue-jsx\": \"^3.0.0\",\r\n \"@vue/babel-plugin-jsx\": \"^1.1.1\",\r\n \"@vue/compiler-sfc\": \"^3.0.4\",\r\n \"conventional-changelog-cli\": \"^2.1.0\",\r\n \"cross-env\": \"^7.0.2\",\r\n \"del\": \"^6.0.0\",\r\n \"gulp\": \"^4.0.2\",\r\n \"gulp-babel\": \"^8.0.0\",\r\n \"highlight.js\": \"^10.4.1\",\r\n \"less\": \"^4.1.2\",\r\n \"lint-staged\": \"^13.0.3\",\r\n \"prettier\": \"^2.7.1\",\r\n \"rimraf\": \"^3.0.0\",\r\n \"transliteration\": \"^2.2.0\",\r\n \"vitepress\": \"^1.0.0-alpha.63\",\r\n \"vitepress-plugin-search\": \"^1.0.4-alpha.17\",\r\n \"vitepress-theme-demoblock\": \"^2.0.0\"\r\n```\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] 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.",[2931],{"name":2868,"color":2869},2157,"The Aside component is render nothing","2023-04-05T00:04:02Z","https://github.com/vuejs/vitepress/issues/2157",0.6708559,{"description":2938,"labels":2939,"number":2943,"owner":2871,"repository":2872,"state":2873,"title":2944,"updated_at":2945,"url":2946,"score":2947},"### Describe the bug\n\nWhen the project first starts: `At least one \u003Ctemplate> or \u003Cscript> is required in a single file component.`,\n\n### Reproduction\n\nhttps://stackblitz.com/edit/vite-nnfopi?file=docs%2Findex.md\n\n### Expected behavior\n\nNormal\n\n### System Info\n\n```sh\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: 16.20.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 pnpm: 8.6.10 - /usr/local/bin/pnpm\r\n npmPackages:\r\n vitepress: latest => 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.",[2940],{"name":2941,"color":2942},"upstream","BF29ED",2801,"At least one \u003Ctemplate> or \u003Cscript> is required in a single file component.","2023-08-25T00:04:16Z","https://github.com/vuejs/vitepress/issues/2801",0.6710254,{"description":2949,"labels":2950,"number":2951,"owner":2871,"repository":2872,"state":2873,"title":2952,"updated_at":2953,"url":2954,"score":2955},"I'm new to vue and vitepress so I'm a little confused.\r\n\r\nI'm looking into adding markdown to my existing vue app. The way I imagined it would be some markdown element which would take the markdown text and render it. I'm also interested in embedding vue components inside the markdown. Something like\r\n```\r\n\u003CMarkdown>\r\n## abc\r\nefg\r\n### hij\r\nHi {{name}},\r\n\u003C/Markdown>\r\n```\r\nI was hoping vitepress would do it, but it seems like vitepress sets everything up as a standalone app. I can't simply add vitepress to my package.json and start using it's elements.\r\n\r\nAny examples of using vitepress in an existing vue as a library? Or any alternative?",[],315,"Use vitepress in an existing vue app","2023-01-21T16:22:21Z","https://github.com/vuejs/vitepress/issues/315",0.6720849,{"description":2957,"labels":2958,"number":2960,"owner":2871,"repository":2872,"state":2873,"title":2961,"updated_at":2962,"url":2963,"score":2964},"**Describe the bug**\r\n\r\nWhen using vitepress with vue v3.1, we are now running into a compilation error as some vitepress components are using `\u003Ctemplate functional>`\r\n\r\nThe related change in vue-next is https://github.com/vuejs/vue-next/commit/467076361a730b7925c88c572793c78637e05ca7\r\n\r\n**To Reproduce**\r\n\r\nSee [this PR in VTU](https://github.com/vuejs/vue-test-utils-next/pull/654) (that uses vitepress for the docs) that fails because of vitepress and vue 3.1 \r\n\r\nIt can easily be reproduced in the current codebase by bumping vue to v3.1 and run `yarn docs-build`:\r\n\r\n```\r\nSyntaxError: \u003Ctemplate functional> is no longer supported in Vue 3, since functional components no longer have significant performance difference from stateful ones. Just use a normal \u003Ctemplate> instead.\r\n at /Users/ced-pro/Code/vue/vitepress/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:196:37\r\n at Array.forEach (\u003Canonymous>)\r\n at parse (/Users/ced-pro/Code/vue/vitepress/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:182:18)\r\n at createDescriptor (/Users/ced-pro/Code/vue/vitepress/node_modules/@vitejs/plugin-vue/dist/index.js:4048:62)\r\n at transformMain (/Users/ced-pro/Code/vue/vitepress/node_modules/@vitejs/plugin-vue/dist/index.js:4344:32)\r\n at Object.transform (/Users/ced-pro/Code/vue/vitepress/node_modules/@vitejs/plugin-vue/dist/index.js:4665:16)\r\n at /Users/ced-pro/Code/vue/vitepress/node_modules/rollup/dist/shared/rollup.js:19875:25 {\r\n loc: {\r\n start: { column: 11, line: 1, offset: 10 },\r\n end: { column: 21, line: 1, offset: 20 },\r\n source: 'functional'\r\n },\r\n id: '/Users/ced-pro/Code/vue/vitepress/dist/client/theme-default/com\r\n```\r\n\r\n**Expected behavior**\r\nvitepress should properly compile with Vue v3.1\r\n\r\n**System Info**\r\n- vitepress version: 0.14\r\n- vite version: 2.3.4\r\n- Node version: 14.17\r\n- OS version: macOS\r\n",[2959],{"name":2882,"color":2883},311,"Functional templates errors with vue v3.1","2023-01-21T16:22:22Z","https://github.com/vuejs/vitepress/issues/311",0.67309135,["Reactive",2966],{},["Set"],["ShallowReactive",2969],{"$fTRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"$f1nO2MIZUQ-527DByGGE-0EsWa5hyh2Mz219BzjAPgnU":-1},"/vuejs/vitepress/2095"]