fix(components): remove invalid chars from component names (#253)

This commit is contained in:
Daniel Roe 2021-06-22 11:03:47 +01:00 committed by GitHub
parent 1518a2a070
commit c124967d8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -1,7 +1,7 @@
declare module 'vue' {
export interface GlobalComponents {
<%= components.map(c => {
return ` ${c.pascalName}: typeof import('${c.filePath}')['${c.export}']`
return ` '${c.pascalName}': typeof import('${c.filePath}')['${c.export}']`
}).join(',\n') %>
}
}

View File

@ -10,7 +10,7 @@ const components = {
c.preload === true || typeof c.preload === 'number' ? `webpackPreload: ${c.preload}` : false,
].filter(Boolean).join(', ')
return ` ${c.pascalName}: defineAsyncComponent(() => import('${c.filePath}' /* ${magicComments} */).then(c => ${exp}))`
return ` '${c.pascalName}': defineAsyncComponent(() => import('${c.filePath}' /* ${magicComments} */).then(c => ${exp}))`
}).join(',\n') %>
}

View File

@ -62,7 +62,7 @@ export async function scanComponents (dirs: ScanDir[], srcDir: string): Promise<
}
resolvedNames.set(componentName, filePath)
const pascalName = pascalCase(componentName)
const pascalName = pascalCase(componentName).replace(/["']/g, '')
const kebabName = hyphenate(componentName)
const shortPath = relative(srcDir, filePath)
const chunkName = 'components/' + kebabName