\r\n\r\n@antd-templater/library-3.x 报错代码的文件部分代码\r\n```typescript\r\nimport { defineComponent, ref, onMounted, createVNode, mergeProps } from 'vue';\r\nimport ATooltip from 'ant-design-vue/es/tooltip';\r\nimport * as VueTypes from 'vue-types';\r\n\r\nconst SEllipsis = /* @__PURE__ */ defineComponent({\r\n // ....\r\n})\r\n```\r\n\r\n\r\n### Reproduction\r\n\r\nhttps://stackblitz.com/edit/vite-kzz2up?file=docs%2F.vitepress%2Ftheme%2Findex.ts\r\n\r\n### Expected behavior\r\n\r\n希望可以正常构建\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: 10.2.3 - /usr/local/bin/npm\r\n pnpm: 8.15.6 - /usr/local/bin/pnpm\r\n npmPackages:\r\n vitepress: latest => 1.1.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.",[],3872,"closed","Error: [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import ...","2024-05-16T04:42:04Z","https://github.com/vuejs/vitepress/issues/3872",0.69575477,{"description":2913,"labels":2914,"number":2915,"owner":2869,"repository":2870,"state":2907,"title":2916,"updated_at":2917,"url":2918,"score":2919},"### Describe the bug\n\nI added two \u003Cscript> to the head configuration that I wanted to execute once per page opened, they worked fine in the development environment, but after packaging and deploying to GitHub Pages, they only executed when the browser was refreshed.\r\n\r\n```\r\n // 百度统计代码:https://tongji.baidu.com\r\n ['script', {}, `var _hmt = _hmt || [];\r\n (function() {\r\n var hm = document.createElement(\"script\");\r\n hm.src = \"https://hm.baidu.com/hm.js?xxxxxxxxxx\";\r\n var s = document.getElementsByTagName(\"script\")[0]; \r\n s.parentNode.insertBefore(hm, s);\r\n })();`],\r\n // 页面访问量统计\r\n ['script', {}, `var pageUrl = location.href;\r\n (function() {\r\n xhr = new XMLHttpRequest();\r\n xhr.open('GET', 'https://xxxxxxxxxx/pv?pageUrl=' + pageUrl + \"&t=\" + new Date().getTime());\r\n xhr.send();\r\n })();`]\r\n```\n\n### Reproduction\n\nN/A\n\n### Expected behavior\n\nN/A\n\n### System Info\n\n```shell\nSystem:\r\n OS: Windows 10 10.0.19044\r\n CPU: (16) x64 AMD Ryzen 7 5800H with Radeon Graphics\r\n Memory: 7.05 GB / 13.87 GB\r\n Binaries:\r\n Node: 16.17.1 - D:\\Develop\\nodejs\\node.EXE\r\n Yarn: 1.22.19 - ~\\AppData\\Roaming\\npm\\yarn.CMD\r\n npm: 8.15.0 - D:\\Develop\\nodejs\\npm.CMD\r\n Browsers:\r\n Internet Explorer: 11.0.19041.1566\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.",[],1643,"The head configuration, when packaged and deployed to GitHub Pages, did not have the desired effect","2023-01-21T14:20:31Z","https://github.com/vuejs/vitepress/issues/1643",0.7045228,{"description":2921,"labels":2922,"number":2923,"owner":2869,"repository":2870,"state":2907,"title":2924,"updated_at":2925,"url":2926,"score":2927},"### Describe the bug\n\nNo `onload` events are fired, unable to find a workaround or any other method for having two scripts load, where one is dependent upon other.\n\n### Reproduction\n\n```\r\nhead:\r\n - ['script', {}, \"console.log('hello world'); window.addEventListener('load', () => {\r\n console.log('Creating form');\r\n })\"]\r\n```\r\n\r\nAdd this to the frontmatter. The `hello world` fires, but the `window`'s `load` never does. I've also tried `document.body.addEventListener...` but to no avail.\r\n\r\nYou can also try:\r\n\r\n```html\r\n\u003Cscript setup>\r\n window.addEventListener('load', () => {\r\n console.log('Creating form from within script');\r\n })\r\n\u003C/script>\r\n```\r\n\r\nwhich behaves the same\n\n### Expected behavior\n\nI should be able to run code `onload` of an element. \n\n### System Info\n\n```Text\nSystem:\r\n OS: macOS 13.0\r\n CPU: (10) arm64 Apple M1 Pro\r\n Memory: 156.86 MB / 16.00 GB\r\n Shell: 5.8.1 - /bin/zsh\r\n Binaries:\r\n Node: 18.15.0 - ~/.nvm/versions/node/v18.15.0/bin/node\r\n Yarn: 1.22.22 - ~/.nvm/versions/node/v18.15.0/bin/yarn\r\n npm: 9.5.0 - ~/.nvm/versions/node/v18.15.0/bin/npm\r\n pnpm: 9.4.0 - ~/.nvm/versions/node/v18.15.0/bin/pnpm\r\n Browsers:\r\n Chrome: 126.0.6478.63\r\n Safari: 16.1\r\n npmPackages:\r\n vitepress: ^1.0.2 => 1.0.2\n```\n\n\n### Additional context\n\nMy specific use case here is that we are using Hubspot forms, which requires me to inject a static js file via a `\u003Cscript />`, and also call a specific function that is dependent upon that script being loaded, i.e:\r\n\r\n```html\r\n\u003Cscript src=\"/load/external/file\" />\r\n\u003Cscript>\r\n// run code dependent upon external file\r\n\u003C/script>\r\n```\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.",[],3982,"Unable to run code `onload`","2024-07-02T04:42:00Z","https://github.com/vuejs/vitepress/issues/3982",0.7169785,{"description":2929,"labels":2930,"number":2932,"owner":2869,"repository":2870,"state":2907,"title":2933,"updated_at":2934,"url":2935,"score":2936},"### Discussed in https://github.com/vuejs/vitepress/discussions/1041\r\n\r\n\u003Cdiv type='discussions-op-text'>\r\n\r\n\u003Csup>Originally posted by **akil-rails** July 22, 2022\u003C/sup>\r\nThe [guide](https://vitepress.vuejs.org/guide/using-vue.html) explains:\r\n\r\n> To use code that assumes a browser environment on import, you need to dynamically import them in proper lifecycle hooks: how to use components th\r\n\r\n```vue\r\n\u003Cscript>\r\nexport default {\r\n mounted() {\r\n import('./lib-that-access-window-on-import').then((module) => {\r\n // use code\r\n })\r\n }\r\n}\r\n\u003C/script>\r\n```\r\n\r\nWhen the library is directly referenced (instead of a dependency), the load fails. Is this the expected behaviour? If so, the docs could mention that.\r\n\r\n`mermaid:1 Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of \"text/html\". Strict MIME type checking is enforced for module scripts per HTML spec.`\r\n\r\n```vue\r\n\u003Cscript>\r\nexport default {\r\n mounted() {\r\n import('https://cdn.skypack.dev/mermaid').then((module) => {\r\n // use code\r\n })\r\n }\r\n}\r\n\u003C/script>\r\n```\r\n\u003C/div>\r\n\r\n\r\n### Steps to reproduce\r\n```\r\ngit clone git@github.com:akil-rails/vitepress-starter.git\r\ncd vitepress-starter\r\npnpm i\r\npnpm run docs:build\r\npnpm run docs:serve\r\n```\r\n1. Open the URL in chrome\r\n2. In chrome developer tools/console, you'll see the message \r\n```\r\nFailed to load module script: Expected a JavaScript module script but the server responded with a MIME type of \"text/html\". Strict MIME type checking is enforced for module scripts per HTML spec.\r\n```",[2931],{"name":2880,"color":2881},1042,"Dynamic Component with External Script - 'Failed to load module script:'","2023-01-21T14:30:10Z","https://github.com/vuejs/vitepress/issues/1042",0.72166294,{"description":2938,"labels":2939,"number":2943,"owner":2869,"repository":2870,"state":2907,"title":2944,"updated_at":2945,"url":2946,"score":2947},"### Describe the bug\n\nI want to add structured data to my app. Therefore I have to insert some JSON-LD to the head of my page layout as follows\r\n```html\r\n\u003Chtml>\r\n \u003Chead>\r\n \u003Cscript type=\"application/ld+json\">\r\n {\r\n \"@context\": \"https://json-ld.org/contexts/person.jsonld\",\r\n \"@id\": \"http://dbpedia.org/resource/John_Lennon\",\r\n \"name\": \"John Lennon\",\r\n \"born\": \"1940-10-09\",\r\n \"spouse\": \"http://dbpedia.org/resource/Cynthia_Lennon\"\r\n }\r\n \u003C/script>\r\n ...\r\n```\r\nAccording to the [documentation](https://vitepress.vuejs.org/config/basics.html) and the [linked source](https://github.com/vuejs/vitepress/blob/main/src/node/build/render.ts) this is how it is done:\r\n```\r\nmodule.exports = {\r\n head: [\r\n ['script', { type: 'application/ld+json' }, '{\"@context\": \"https://json-ld.org/contexts/person.jsonld\", \"@id\": \"http://dbpedia.org/resource/John_Lennon\", \"name\": \"John Lennon\", \"born\": \"1940-10-09\", \"spouse\": \"http://dbpedia.org/resource/Cynthia_Lennon\"}']\r\n ]\r\n}\r\n```\r\nBut this will fail with the following message:\r\n```\r\n✖ rendering pages...\r\nbuild error:\r\n Error: Transform failed with 1 error:\r\ninline-script.js:1:11: error: Expected \";\" but found \":\"\r\n at failureErrorWithLog (/home/raymond/Sites/website-next/node_modules/esbuild/lib/main.js:1493:15)\r\n at /home/raymond/Sites/website-next/node_modules/esbuild/lib/main.js:1282:29\r\n at /home/raymond/Sites/website-next/node_modules/esbuild/lib/main.js:629:9\r\n at handleIncomingPacket (/home/raymond/Sites/website-next/node_modules/esbuild/lib/main.js:726:9)\r\n at Socket.readFromStdout (/home/raymond/Sites/website-next/node_modules/esbuild/lib/main.js:596:7)\r\n at Socket.emit (events.js:400:28)\r\n at addChunk (internal/streams/readable.js:293:12)\r\n at readableAddChunk (internal/streams/readable.js:267:9)\r\n at Socket.Readable.push (internal/streams/readable.js:206:10)\r\n at Pipe.onStreamRead (internal/stream_base_commons.js:188:23) {\r\n errors: [\r\n {\r\n detail: undefined,\r\n location: [Object],\r\n notes: [],\r\n pluginName: '',\r\n text: 'Expected \";\" but found \":\"'\r\n }\r\n ],\r\n warnings: [],\r\n frame: '\\n' +\r\n '\\x1B[33mExpected \";\" but found \":\"\\x1B[39m\\n' +\r\n '1 | {\"@context\": \"https://json-ld.org/contexts/person.jsonld\", \"@id\": \"http://dbpedia.org/resource/John_Lennon\", \"name\": \"John Lennon\", \"born\": \"1940-10-09\", \"spouse\": \"http://dbpedia.org/resource/Cynthia_Lennon\"}\\n' +\r\n ' | ^\\n',\r\n loc: {\r\n column: 11,\r\n file: 'inline-script.js',\r\n length: 1,\r\n line: 1,\r\n lineText: '{\"@context\": \"https://json-ld.org/contexts/person.jsonld\", \"@id\": \"http://dbpedia.org/resource/John_Lennon\", \"name\": \"John Lennon\", \"born\": \"1940-10-09\", \"spouse\": \"http://dbpedia.org/resource/Cynthia_Lennon\"}',\r\n namespace: '',\r\n suggestion: ''\r\n }\r\n}\r\nerror Command failed with exit code 1.\r\n\r\n```\n\n### Reproduction\n\nTry to add a `\u003Cscript>` tag the head that consists of non-javascript content. For example:\r\n```html\r\nmodule.exports = {\r\n head: [\r\n ['script', { type: 'application/ld+json' }, '{ \"foo\": \"bar\" }']\r\n ]\r\n}\r\n```\n\n### Expected behavior\n\nI expect that the defined `\u003Cscript>` tag will be added to my sites head.\n\n### System Info\n\n```shell\nSystem:\r\n OS: Linux 5.13 Ubuntu 20.04.3 LTS (Focal Fossa)\r\n CPU: (8) x64 Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz\r\n Memory: 10.35 GB / 23.13 GB\r\n Container: Yes\r\n Shell: 5.8 - /usr/bin/zsh\r\nBinaries:\r\n Node: 14.18.3 - ~/.nvm/versions/node/v14.18.3/bin/node\r\n Yarn: 1.22.17 - ~/Sites/website-next/node_modules/.bin/yarn\r\n npm: 6.14.15 - ~/.nvm/versions/node/v14.18.3/bin/npm\r\nBrowsers:\r\n Chromium: 98.0.4758.80\r\n Firefox: 97.0\r\nnpmPackages:\r\n vitepress: ^0.21.6 => 0.21.6\n```\n\n\n### Additional context\n\nI already proposed a bug fix: #517 \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.",[2940],{"name":2941,"color":2942},"bug: pending triage","e99695",538,"Can't add a non-javascript script tag to the head","2023-01-21T16:20:08Z","https://github.com/vuejs/vitepress/issues/538",0.7326524,{"description":2949,"labels":2950,"number":2953,"owner":2869,"repository":2870,"state":2907,"title":2954,"updated_at":2955,"url":2956,"score":2957},"### Describe the bug\r\n\r\nSyntaxError: The requested module '/component/util/allsuperclassframes.data.js?t=1697876520202' does not provide an export named 'allSuperclassFrames' (at application_provider.md:11:10)`\r\n\r\n**Data Loader** \r\n\r\n```js\r\nexport default {\r\n watch: ['../../**/class/*.json'],\r\n async load(watchedFiles) {\r\n // watchedFiles will be an array of absolute paths of the matched files.\r\n // generate an array of blog post metadata that can be used to render\r\n // a list in the theme layout\r\n console.log('watchedFiles.length :::: ', watchedFiles.length)\r\n let allSuperclassFrames/*:FrameDbDataModel[]*/ = []\r\n let superclasses = watchedFiles.map((file) => {\r\n return JSON.parse(fs.readFileSync(file, 'utf-8')).filter\r\n })\r\n superclasses.forEach(s => {\r\n if(! allSuperclassFrames.find(r => r.frame === s.frame && r.short_value === s.short_value)){\r\n allSuperclassFrames.push(s)\r\n }\r\n })\r\n console.log('result.length :::: ', allSuperclassFrames.length)\r\n return {allSuperclassFrames}\r\n }\r\n}\r\n```\r\n\r\n**Import data loader**\r\n\r\n```vue\r\n\u003Cscript setup>\r\nimport { allSuperclassFrames } from '../../../component/util/allSuperclassFrames.data'\r\n...\r\n```\r\n\r\n**package.json**\r\n\r\n```json\r\n...\r\n\"type\": \"module\",\r\n...\r\n```\r\n\r\n### Reproduction\r\n\r\nts or js data loader for local files.\r\n\r\n**Related ?**\r\n\r\nhttps://github.com/vuejs/vitepress/pull/3058\r\n\r\nhttps://github.com/vuejs/vitepress/issues/3051\r\n\r\n### Expected behavior\r\n\r\nLoad data as documented \r\n\r\nhttps://vitepress.dev/guide/data-loading#basic-usage\r\n\r\n### System Info\r\n\r\n```\r\nSystem:\r\n OS: Windows 10 10.0.22000\r\n CPU: (8) x64 Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz\r\n Memory: 5.61 GB / 15.88 GB\r\n Binaries:\r\n Node: 18.15.0 - D:\\Tools\\Nodejs\\18.15.0\\node.EXE\r\n npm: 9.8.1 - D:\\Tools\\Nodejs\\18.15.0\\npm.CMD\r\n pnpm: 8.6.3 - D:\\Tools\\Nodejs\\18.15.0\\pnpm.CMD\r\n Browsers:\r\n Edge: Spartan (44.22000.120.0), Chromium (118.0.2088.57)\r\n Internet Explorer: 11.0.22000.120\r\n npmPackages:\r\n vitepress: v1.0.0-rc.22 => 1.0.0-rc.22\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.",[2951,2952],{"name":2892,"color":2893},{"name":2895,"color":2896},3113,"Data Loader Error : ... does not provide an export named ...","2023-10-30T00:04:38Z","https://github.com/vuejs/vitepress/issues/3113",0.73736465,{"description":2959,"labels":2960,"number":2962,"owner":2869,"repository":2870,"state":2907,"title":2963,"updated_at":2964,"url":2965,"score":2966},"### Describe the bug\n\nFocus in Code Blocks not working in my project, is it necessary anymore dependencies ?\n\n### Reproduction\n\n```js\r\nexport default {\r\n data () {\r\n return {\r\n msg: 'Focused!' // [!code focus]\r\n }\r\n }\r\n}\r\n```\n\n### Expected behavior\n\n```js\r\nexport default {\r\n data () {\r\n return {\r\n msg: 'Focused!' // [!code focus]\r\n }\r\n }\r\n}\r\n```\n\n### System Info\n\n```shell\nwindows\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.",[2961],{"name":2941,"color":2942},1926,"Focus in Code Blocks","2023-02-19T00:04:40Z","https://github.com/vuejs/vitepress/issues/1926",0.73842895,["Reactive",2968],{},["Set"],["ShallowReactive",2971],{"$fTRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"$fctFeuSWdnX2kW4-q-QlhFhQPrkWGKazEVR8MTzW55Bo":-1},"/vuejs/vitepress/1110"]