fix: explicitly set component name (#657) (#681)

fix: #657
pull/686/head
Divyansh Singh 3 years ago committed by GitHub
parent 5f0d9153a3
commit 4fd2fad1fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -3,7 +3,7 @@
"version": "1.0.0-draft.8", "version": "1.0.0-draft.8",
"description": "Vite & Vue powered static site generator", "description": "Vite & Vue powered static site generator",
"type": "module", "type": "module",
"packageManager": "pnpm@7.0.1", "packageManager": "pnpm@7.1.7",
"main": "dist/node/index.js", "main": "dist/node/index.js",
"types": "types/index.d.ts", "types": "types/index.d.ts",
"exports": { "exports": {
@ -78,7 +78,7 @@
"body-scroll-lock": "^4.0.0-beta.0", "body-scroll-lock": "^4.0.0-beta.0",
"shiki": "^0.10.1", "shiki": "^0.10.1",
"vite": "^2.9.7", "vite": "^2.9.7",
"vue": "3.2.33" "vue": "^3.2.33"
}, },
"devDependencies": { "devDependencies": {
"@rollup/plugin-alias": "^3.1.5", "@rollup/plugin-alias": "^3.1.5",

@ -69,7 +69,7 @@ importers:
typescript: ^4.7.2 typescript: ^4.7.2
vite: ^2.9.7 vite: ^2.9.7
vitest: ^0.10.4 vitest: ^0.10.4
vue: 3.2.33 vue: ^3.2.33
dependencies: dependencies:
'@docsearch/css': 3.1.0 '@docsearch/css': 3.1.0
'@docsearch/js': 3.1.0 '@docsearch/js': 3.1.0

@ -188,10 +188,16 @@ function genPageDataCode(tags: string[], data: PageData) {
defaultExportRE.test(tagSrc) || namedDefaultExportRE.test(tagSrc) defaultExportRE.test(tagSrc) || namedDefaultExportRE.test(tagSrc)
tags[existingScriptIndex] = tagSrc.replace( tags[existingScriptIndex] = tagSrc.replace(
scriptRE, scriptRE,
code + (hasDefaultExport ? `` : `\nexport default{}\n`) + `</script>` code +
(hasDefaultExport
? ``
: `\nexport default {name:'${data.relativePath}'}`) +
`</script>`
) )
} else { } else {
tags.unshift(`<script>${code}\nexport default {}</script>`) tags.unshift(
`<script>${code}\nexport default {name:'${data.relativePath}'}</script>`
)
} }
return tags return tags

Loading…
Cancel
Save