From 4fd2fad1fa665fb3c7a6d6896a291e6889ad10bc Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Mon, 30 May 2022 11:24:27 +0530 Subject: [PATCH] fix: explicitly set component name (#657) (#681) fix: #657 --- package.json | 4 ++-- pnpm-lock.yaml | 2 +- src/node/markdownToVue.ts | 10 ++++++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 3b098f27..12fd7d68 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "1.0.0-draft.8", "description": "Vite & Vue powered static site generator", "type": "module", - "packageManager": "pnpm@7.0.1", + "packageManager": "pnpm@7.1.7", "main": "dist/node/index.js", "types": "types/index.d.ts", "exports": { @@ -78,7 +78,7 @@ "body-scroll-lock": "^4.0.0-beta.0", "shiki": "^0.10.1", "vite": "^2.9.7", - "vue": "3.2.33" + "vue": "^3.2.33" }, "devDependencies": { "@rollup/plugin-alias": "^3.1.5", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ba25cb56..322d556f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -69,7 +69,7 @@ importers: typescript: ^4.7.2 vite: ^2.9.7 vitest: ^0.10.4 - vue: 3.2.33 + vue: ^3.2.33 dependencies: '@docsearch/css': 3.1.0 '@docsearch/js': 3.1.0 diff --git a/src/node/markdownToVue.ts b/src/node/markdownToVue.ts index fde93186..273d4dc1 100644 --- a/src/node/markdownToVue.ts +++ b/src/node/markdownToVue.ts @@ -188,10 +188,16 @@ function genPageDataCode(tags: string[], data: PageData) { defaultExportRE.test(tagSrc) || namedDefaultExportRE.test(tagSrc) tags[existingScriptIndex] = tagSrc.replace( scriptRE, - code + (hasDefaultExport ? `` : `\nexport default{}\n`) + `` + code + + (hasDefaultExport + ? `` + : `\nexport default {name:'${data.relativePath}'}`) + + `` ) } else { - tags.unshift(``) + tags.unshift( + `` + ) } return tags