\r\n\u003C/div>\r\n`\r\n\r\n// when creating a demo section, `@/` will be replaced with `srcDir`\r\nexport const demoPlugin = (md: MarkdownIt, srcDir: string) => {\r\n const parser: RuleBlock = (state, startLine, _endLine, _silent) => {\r\n /*... some code to extract the file name from the markdown ... */\r\n token.attrSet('src', resolve(filename))\r\n return true\r\n }\r\n\r\n const renderer: RenderRule = (...args) => {\r\n /* ... some code to get `src` and check that the file exists ... */\r\n \r\n const file = readFileSync(src, 'utf8')\r\n\r\n // script\r\n token.info = `ts`\r\n token.content = findSection(file, SCRIPT_START, SCRIPT_END)\r\n const script = md.renderer.rules.fence!(...args)\r\n\r\n // template\r\n token.info = `vue-html`\r\n token.content = findSection(file, TEMPLATE_START, TEMPLATE_END)\r\n const template = md.renderer.rules.fence!(...args)\r\n\r\n // component\r\n const demo = md.render(COMPONENT_SNIPPET(src))\r\n\r\n return script + template + demo\r\n }\r\n\r\n md.renderer.rules.demo = renderer\r\n md.block.ruler.before(md.block.ruler.getRules('')[0].name, 'demo', parser)\r\n}\r\n\r\n// returns everything between the first match of `start` and the subsequent first match for `end`\r\nfunction findSection(content: string, start: RegExp, end: RegExp): string {\r\n //...\r\n}\r\n``` \r\n\r\nSo the markdown rendered used to take the line `const demo = md.render(COMPONENT_SNIPPET(src))` and automagically put the `import` statement where it needs to be and happily render the component. However, since updating to `1.0.0-alpha.11` this no longer works. In fact if I manually write out the import statement in the markdown file, everything works - so something is wrong with the way my plugin is handling the import.\r\n\r\nI looked into the way [plugin-sfc](https://github.com/mdit-vue/mdit-vue/tree/main/packages/plugin-sfc) works and it looks like there was a change from `0.10.0` to `0.11.0` in the way script SFC blocks are handled.\r\n\r\nI tried to copy the way the changed code works in my plugin, but I have not managed to get it working:\r\n\r\n```ts\r\n const block = `\u003Cscript setup lang=\"ts\"> import DemoComponent from \"${src}\"; \u003C/script>`\r\n sfcBlocks.scriptSetup = block\r\n sfcBlocks.scripts.push(block)\r\n\r\n token.content = `\u003Cdiv class=\"vp-raw\"> \u003Cdemo-component/> \u003C/div>`\r\n const demo = md.renderer.rules.html_block!(...args)\r\n```\r\n\r\nDoes anyone know how this can be done? How can my plugin tell VitePress that it needs to import the demo component for this page?\r\n",[],1349,"Import custom component in MarkdownIt plugin","2023-01-21T14:22:46Z","https://github.com/vuejs/vitepress/issues/1349",0.71267295,{"description":2960,"labels":2961,"number":2965,"owner":2868,"repository":2869,"state":2893,"title":2966,"updated_at":2967,"url":2968,"score":2969},"### Describe the bug\n\nbuild error:\r\nThe requested module 'vue' does not provide an export named 'default'\r\nfile:///Users/lee/Codes/Work/PanSoft/pan-ui-vue/apps/docs/.vitepress/.temp/index.gDrBdFYw.js:1\r\nimport require$$0, { defineComponent, createVNode, ref, computed, watch, Fragment, watchEffect, createTextVNode, toRaw, mergeModels, useModel, openBlock, createBlock, unref, mergeProps, createSlots, withCtx, normalizeClass, createElementBlock, createElementVNode, toDisplayString, renderList, renderSlot, normalizeProps, nextTick } from \"vue\";\r\n\r\nSyntaxError: The requested module 'vue' does not provide an export named 'default'\r\n at ModuleJob._instantiate (node:internal/modules/esm/module_job:132:21)\r\n at async ModuleJob.run (node:internal/modules/esm/module_job:214:5)\r\n at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)\r\n at async build (file:///Users/lee/Codes/Work/PanSoft/pan-ui-vue/node_modules/.pnpm/vitepress@1.3.3_@algolia+client-search@4.24.0_@types+node@22.0.0_async-validator@4.2.5_less@4_vyupewqor5ionkpvva6zm6cw7u/node_modules/vitepress/dist/node/serve-lJPQ9bCN.js:47053:24)\n\n### Reproduction\n\n{\r\n \"name\": \"docs\",\r\n \"private\": true,\r\n \"scripts\": {\r\n \"dev\": \"vitepress dev\",\r\n \"docs:build\": \"vitepress build\",\r\n \"docs:preview\": \"vitepress preview\"\r\n },\r\n \"dependencies\": {\r\n \"@panui-vue/base\": \"workspace:*\",\r\n \"@panui-vue/pro\": \"workspace:*\",\r\n \"@panui-vue/icon\": \"workspace:*\",\r\n \"@panui-vue/excel\": \"workspace:*\",\r\n \"vue\": \"^3.4.31\",\r\n \"lodash-es\": \"^4.17.21\",\r\n \"@formily/vue\": \"^2.3.2\",\r\n \"dayjs\": \"1.11.12\"\r\n },\r\n \"devDependencies\": {\r\n \"@faker-js/faker\": \"^8.4.1\",\r\n \"@vitepress-demo-preview/component\": \"^2.3.2\",\r\n \"@vitepress-demo-preview/plugin\": \"^1.2.3\",\r\n \"postcss\": \"^8.4.40\",\r\n \"rollup-plugin-visualizer\": \"^5.12.0\",\r\n \"typescript\": \"^5.2.2\",\r\n \"vitepress\": \"^1.3.3\",\r\n \"@types/lodash-es\": \"^4.17.12\",\r\n \"@vitejs/plugin-vue-jsx\": \"^4.0.0\"\r\n }\r\n}\n\n### Expected behavior\n\nNormal build\n\n### System Info\n\n```Text\nSystem:\r\n OS: macOS 14.6.1\r\n CPU: (10) arm64 Apple M1 Pro\r\n Memory: 185.47 MB / 16.00 GB\r\n Shell: 5.9 - /bin/zsh\r\n Binaries:\r\n Node: 20.11.1 - ~/.nvm/versions/node/v20.11.1/bin/node\r\n npm: 10.2.4 - ~/.nvm/versions/node/v20.11.1/bin/npm\r\n pnpm: 9.7.1 - ~/.nvm/versions/node/v20.11.1/bin/pnpm\r\n Browsers:\r\n Chrome: 127.0.6533.120\r\n Edge: 127.0.2651.105\r\n Safari: 17.6\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.",[2962],{"name":2963,"color":2964},"need more info","bdbefc",4158,"SyntaxError: The requested module 'vue' does not provide an export named 'default'","2024-09-03T04:42:37Z","https://github.com/vuejs/vitepress/issues/4158",0.7136542,["Reactive",2971],{},["Set"],["ShallowReactive",2974],{"$fTRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"$f2yEtXbUFadVqAB_hSnSK1RYecyr5j3Z04EQ6wV_gFmI":-1},"/vuejs/vitepress/4172"]